All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] loop: Fix teardown
@ 2026-09-17 21:20 Bart Van Assche
  2026-09-17 21:20 ` [PATCH v2 1/2] block: Add post_release() operation Bart Van Assche
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Van Assche @ 2026-09-17 21:20 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Christoph Hellwig, Tetsuo Handa, Nilay Shroff,
	Bart Van Assche

Hi Jens,

This series fixes loop driver teardown. When tearing down an autoclear loop
device, the loop driver must drain in-flight I/O and flush workqueues to
prevent NULL pointer dereferences in lo_rw_aio() and related I/O paths.

The .release() block device callback is invoked while holding
disk->open_mutex. Freezing the request queue or draining workqueues under
disk->open_mutex causes lock inversion and circular locking dependencies
(e.g., when worker threads or I/O completion paths also acquire open_mutex
or interact with request queue synchronization).

This patch series resolves the lock inversion by:
1. Adding a .post_release() block device operation that is called
   synchronously from bdev_release() immediately after disk->open_mutex
   is released.
2. Migrating __loop_clr_fd() to .post_release(), allowing loop device
   teardown and queue freezing to happen outside of disk->open_mutex.

This series is inspired by Tetsuo's loop driver patch series.

Please consider applying this patch series.

Thanks,

Bart.

Bart Van Assche (1):
  loop: Perform __loop_clr_fd() after disk->open_mutex is dropped

Tetsuo Handa (1):
  block: Add post_release() operation

 block/bdev.c                     |  3 ++
 drivers/block/loop.c             | 60 +++++++++++++++++++++++---------
 include/linux/blkdev.h           |  8 +++++
 rust/kernel/block/mq/gen_disk.rs |  1 +
 4 files changed, 56 insertions(+), 16 deletions(-)


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

end of thread, other threads:[~2026-09-17 21:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-17 21:20 [PATCH v2 0/2] loop: Fix teardown Bart Van Assche
2026-09-17 21:20 ` [PATCH v2 1/2] block: Add post_release() operation Bart Van Assche
2026-09-17 21:20   ` [PATCH v2 2/2] loop: Perform __loop_clr_fd() after disk->open_mutex is dropped Bart Van Assche

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.