summaryrefslogtreecommitdiff
path: root/drivers/block
diff options
context:
space:
mode:
authorMd Haris Iqbal <haris.iqbal@cloud.ionos.com>2020-12-10 11:18:22 +0100
committerJens Axboe <axboe@kernel.dk>2020-12-16 14:55:50 -0700
commit87019e7d99d707e60e20ea3245a561419d5de5ce (patch)
treef3c2ce201f44310ad99ca76b7f89e2bc81ff7b5b /drivers/block
parent46067844efdb8275ade705923120fc5391543b53 (diff)
block/rnbd-srv: Protect dev session sysfs removal
Since the removal of the session sysfs can also be called from the function destroy_sess, there is a need to protect the call from the function rnbd_srv_sess_dev_force_close Fixes: 786998050cbc ("block/rnbd-srv: close a mapped device from server side.") Signed-off-by: Md Haris Iqbal <haris.iqbal@cloud.ionos.com> Reviewed-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com> Signed-off-by: Jack Wang <jinpu.wang@cloud.ionos.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/rnbd/rnbd-srv.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv.c
index d1ee72ed8384..066411cce5e2 100644
--- a/drivers/block/rnbd/rnbd-srv.c
+++ b/drivers/block/rnbd/rnbd-srv.c
@@ -338,9 +338,10 @@ static int rnbd_srv_link_ev(struct rtrs_srv *rtrs,
void rnbd_srv_sess_dev_force_close(struct rnbd_srv_sess_dev *sess_dev)
{
+ mutex_lock(&sess_dev->sess->lock);
rnbd_srv_destroy_dev_session_sysfs(sess_dev);
+ mutex_unlock(&sess_dev->sess->lock);
sess_dev->keep_id = true;
-
}
static int process_msg_close(struct rtrs_srv *rtrs,