mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] loop: add missing bd_abort_claiming in loop_set_status
@ 2026-01-07 10:41 Tetsuo Handa
  2026-01-07 15:08 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Tetsuo Handa @ 2026-01-07 10:41 UTC (permalink / raw)
  To: Jens Axboe, Raphael Pinsonneault-Thibeault, Jan Kara,
	linux-block, linux-kernel

Commit 08e136ebd193 ("loop: don't change loop device under exclusive
opener in loop_set_status") forgot to call bd_abort_claiming() when
mutex_lock_killable() failed.

Fixes: 08e136ebd193 ("loop: don't change loop device under exclusive opener in loop_set_status")
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
---
Since that commit for some reason calls loop_reread_partitions() when
bd_prepare_to_claim() failed, this patch calls loop_reread_partitions()
when mutex_lock_killable() failed after bd_abort_claiming()...
Maybe we should return as soon as possible?

 drivers/block/loop.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index ca74cc31bf07f..bd59c0e9508b7 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1245,7 +1245,8 @@ loop_set_status(struct loop_device *lo, blk_mode_t mode,
 
 	err = mutex_lock_killable(&lo->lo_mutex);
 	if (err)
-		return err;
+		goto out_abort_claiming;
+
 	if (lo->lo_state != Lo_bound) {
 		err = -ENXIO;
 		goto out_unlock;
@@ -1284,6 +1285,7 @@ loop_set_status(struct loop_device *lo, blk_mode_t mode,
 	}
 out_unlock:
 	mutex_unlock(&lo->lo_mutex);
+out_abort_claiming:
 	if (!(mode & BLK_OPEN_EXCL))
 		bd_abort_claiming(bdev, loop_set_status);
 out_reread_partitions:
-- 
2.47.3


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] loop: add missing bd_abort_claiming in loop_set_status
  2026-01-07 10:41 [PATCH] loop: add missing bd_abort_claiming in loop_set_status Tetsuo Handa
@ 2026-01-07 15:08 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2026-01-07 15:08 UTC (permalink / raw)
  To: Raphael Pinsonneault-Thibeault, Jan Kara, linux-block,
	linux-kernel, Tetsuo Handa


On Wed, 07 Jan 2026 19:41:43 +0900, Tetsuo Handa wrote:
> Commit 08e136ebd193 ("loop: don't change loop device under exclusive
> opener in loop_set_status") forgot to call bd_abort_claiming() when
> mutex_lock_killable() failed.
> 
> 

Applied, thanks!

[1/1] loop: add missing bd_abort_claiming in loop_set_status
      commit: 2704024d83fa9eb8e5f16925aae340fd9d246694

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-01-07 15:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-01-07 10:41 [PATCH] loop: add missing bd_abort_claiming in loop_set_status Tetsuo Handa
2026-01-07 15:08 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®