diff options
author | Christoph Hellwig <hch@lst.de> | 2023-10-17 20:48:21 +0200 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2023-10-28 13:29:23 +0200 |
commit | 6e57236ed6e070607868da70fac3d52ae24e5417 (patch) | |
tree | c8ded2d5e3ead036b4c91f89c02c7fe844a2af04 /drivers/block | |
parent | block: WARN_ON_ONCE() when we remove active partitions (diff) | |
download | linux-6e57236ed6e070607868da70fac3d52ae24e5417.tar.xz linux-6e57236ed6e070607868da70fac3d52ae24e5417.zip |
block: move bdev_mark_dead out of disk_check_media_change
disk_check_media_change is mostly called from ->open where it makes
little sense to mark the file system on the device as dead, as we
are just opening it. So instead of calling bdev_mark_dead from
disk_check_media_change move it into the few callers that are not
in an open instance. This avoid calling into bdev_mark_dead and
thus taking s_umount with open_mutex held.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20231017184823.1383356-4-hch@lst.de
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Christian Brauner <brauner@kernel.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/ataflop.c | 4 | ||||
-rw-r--r-- | drivers/block/floppy.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c index cd738cab725f..50949207798d 100644 --- a/drivers/block/ataflop.c +++ b/drivers/block/ataflop.c @@ -1760,8 +1760,10 @@ static int fd_locked_ioctl(struct block_device *bdev, blk_mode_t mode, /* invalidate the buffer track to force a reread */ BufferDrive = -1; set_bit(drive, &fake_change); - if (disk_check_media_change(disk)) + if (disk_check_media_change(disk)) { + bdev_mark_dead(disk->part0, true); floppy_revalidate(disk); + } return 0; default: return -EINVAL; diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index ea4eb88a2e45..11114a5d9e5c 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c @@ -3215,8 +3215,10 @@ static int invalidate_drive(struct gendisk *disk) /* invalidate the buffer track to force a reread */ set_bit((long)disk->private_data, &fake_change); process_fd_request(); - if (disk_check_media_change(disk)) + if (disk_check_media_change(disk)) { + bdev_mark_dead(disk->part0, true); floppy_revalidate(disk); + } return 0; } |