Commit 7e9b1879 authored by Litao Jiao's avatar Litao Jiao
Browse files

net/smc: replace mutex rmbs_lock and sndbufs_lock with rw_semaphore

mainline inclusion
from mainline-v6.3-rc1
commit aff7bfed
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I7809T
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/net/smc?id=aff7bfed9097435ea38de919befbe2d7771a3e87



--------------------------------

It's clear that rmbs_lock and sndbufs_lock are aims to protect the
rmbs list or the sndbufs list.

During connection establieshment, smc_buf_get_slot() will always
be invoked, and it only performs read semantics in rmbs list and
sndbufs list.

Based on the above considerations, we replace mutex with rw_semaphore.
Only smc_buf_get_slot() use down_read() to allow smc_buf_get_slot()
run concurrently, other part use down_write() to keep exclusive
semantics.

Signed-off-by: default avatarD. Wythe <alibuda@linux.alibaba.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarLitao Jiao <jiaolitao@sangfor.com.cn>
parent c87e42bb
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment