Patch "block/rnbd-srv: Set keep_id to true after mutex_trylock" has been added to the 5.18-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    block/rnbd-srv: Set keep_id to true after mutex_trylock

to the 5.18-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     block-rnbd-srv-set-keep_id-to-true-after-mutex_trylo.patch
and it can be found in the queue-5.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit b75459de48a84a6aab6e808db45fc1bd151c898c
Author: Md Haris Iqbal <haris.iqbal@xxxxxxxxx>
Date:   Thu Jul 7 16:31:21 2022 +0200

    block/rnbd-srv: Set keep_id to true after mutex_trylock
    
    [ Upstream commit 4bc14f3101364877dd59085f39e068a2a7ec9f2d ]
    
    After setting keep_id if the mutex trylock fails, the keep_id stays set
    for the rest of the sess_dev lifetime.
    
    Therefore, set keep_id to true after mutex_trylock succeeds, so that a
    failure of trylock does'nt touch keep_id.
    
    Fixes: b168e1d85cf3 ("block/rnbd-srv: Prevent a deadlock generated by accessing sysfs in parallel")
    Cc: gi-oh.kim@xxxxxxxxx
    Signed-off-by: Md Haris Iqbal <haris.iqbal@xxxxxxxxx>
    Signed-off-by: Jack Wang <jinpu.wang@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20220707143122.460362-2-haris.iqbal@xxxxxxxxx
    Signed-off-by: Jens Axboe <axboe@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/block/rnbd/rnbd-srv.c b/drivers/block/rnbd/rnbd-srv.c
index f04df6294650..963df70ea026 100644
--- a/drivers/block/rnbd/rnbd-srv.c
+++ b/drivers/block/rnbd/rnbd-srv.c
@@ -323,10 +323,11 @@ void rnbd_srv_sess_dev_force_close(struct rnbd_srv_sess_dev *sess_dev,
 {
 	struct rnbd_srv_session	*sess = sess_dev->sess;
 
-	sess_dev->keep_id = true;
 	/* It is already started to close by client's close message. */
 	if (!mutex_trylock(&sess->lock))
 		return;
+
+	sess_dev->keep_id = true;
 	/* first remove sysfs itself to avoid deadlock */
 	sysfs_remove_file_self(&sess_dev->kobj, &attr->attr);
 	rnbd_srv_destroy_dev_session_sysfs(sess_dev);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux