]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
block/rnbd-srv: Set keep_id to true after mutex_trylock
authorMd Haris Iqbal <haris.iqbal@ionos.com>
Thu, 7 Jul 2022 14:31:21 +0000 (16:31 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Aug 2022 12:41:56 +0000 (14:41 +0200)
commitb5d8c51f9439f27e7cac7d988e26457b2195f8dc
tree57dc0ca57dfe0e6c3a781f989ae50ea12e5f2738
parentdb924bd8484c76558a4ac4c4b5aeb52e857f0341
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@ionos.com
Signed-off-by: Md Haris Iqbal <haris.iqbal@ionos.com>
Signed-off-by: Jack Wang <jinpu.wang@ionos.com>
Link: https://lore.kernel.org/r/20220707143122.460362-2-haris.iqbal@ionos.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/block/rnbd/rnbd-srv.c