linux-stable/drivers/block
Alyssa Ross bb430b6942 loop: LOOP_CONFIGURE: send uevents for partitions
LOOP_CONFIGURE is, as far as I understand it, supposed to be a way to
combine LOOP_SET_FD and LOOP_SET_STATUS64 into a single syscall.  When
using LOOP_SET_FD+LOOP_SET_STATUS64, a single uevent would be sent for
each partition found on the loop device after the second ioctl(), but
when using LOOP_CONFIGURE, no such uevent was being sent.

In the old setup, uevents are disabled for LOOP_SET_FD, but not for
LOOP_SET_STATUS64.  This makes sense, as it prevents uevents being
sent for a partially configured device during LOOP_SET_FD - they're
only sent at the end of LOOP_SET_STATUS64.  But for LOOP_CONFIGURE,
uevents were disabled for the entire operation, so that final
notification was never issued.  To fix this, reduce the critical
section to exclude the loop_reread_partitions() call, which causes
the uevents to be issued, to after uevents are re-enabled, matching
the behaviour of the LOOP_SET_FD+LOOP_SET_STATUS64 combination.

I noticed this because Busybox's losetup program recently changed from
using LOOP_SET_FD+LOOP_SET_STATUS64 to LOOP_CONFIGURE, and this broke
my setup, for which I want a notification from the kernel any time a
new partition becomes available.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
[hch: reduced the critical section]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Fixes: 3448914e8c ("loop: Add LOOP_CONFIGURE ioctl")
Link: https://lore.kernel.org/r/20230320125430.55367-1-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2023-03-27 13:27:06 -06:00
..
aoe
drbd
mtip32xx
null_blk block: null_blk: cleanup null_queue_rq() 2023-03-15 06:50:24 -06:00
rnbd
xen-blkback
zram - Daniel Verkamp has contributed a memfd series ("mm/memfd: add 2023-02-23 17:09:35 -08:00
amiflop.c
ataflop.c
brd.c - Daniel Verkamp has contributed a memfd series ("mm/memfd: add 2023-02-23 17:09:35 -08:00
floppy.c
Kconfig ATA changes for 6.3-rc1 2023-02-22 13:35:51 -08:00
loop.c loop: LOOP_CONFIGURE: send uevents for partitions 2023-03-27 13:27:06 -06:00
Makefile
n64cart.c
nbd.c
pktcdvd.c
ps3disk.c
ps3vram.c
rbd_types.h
rbd.c Two small fixes from Xiubo and myself, marked for stable. 2023-03-02 10:48:30 -08:00
sunvdc.c block: sunvdc: add check for mdesc_grab() returning NULL 2023-03-15 08:48:58 -06:00
swim3.c
swim_asm.S
swim.c
ublk_drv.c block/io_uring: pass in issue_flags for uring_cmd task_work handling 2023-03-20 20:01:25 -06:00
virtio_blk.c virtio,vhost,vdpa: features, fixes 2023-02-25 11:48:02 -08:00
xen-blkfront.c
z2ram.c