Commit 4b273122 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe

loop: don't grab a reference to the block device

The whole device block device won't be removed while the disk is still
alive, so don't bother to grab a reference to it.
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarJosef Bacik <josef@toxicpanda.com>
Reviewed-by: default avatarMing Lei <ming.lei@rehat.com>
Reviewed-by: default avatarChaitanya Kulkarni <ckulkarnilinux@gmail.com>
Link: https://lore.kernel.org/r/20210722075402.983367-8-hch@lst.deSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 9d3b8813
...@@ -1304,10 +1304,6 @@ static int loop_configure(struct loop_device *lo, fmode_t mode, ...@@ -1304,10 +1304,6 @@ static int loop_configure(struct loop_device *lo, fmode_t mode,
if (partscan) if (partscan)
lo->lo_disk->flags &= ~GENHD_FL_NO_PART_SCAN; lo->lo_disk->flags &= ~GENHD_FL_NO_PART_SCAN;
/* Grab the block_device to prevent its destruction after we
* put /dev/loopXX inode. Later in __loop_clr_fd() we bdput(bdev).
*/
bdgrab(bdev);
loop_global_unlock(lo, is_loop); loop_global_unlock(lo, is_loop);
if (partscan) if (partscan)
loop_reread_partitions(lo); loop_reread_partitions(lo);
...@@ -1398,7 +1394,6 @@ static int __loop_clr_fd(struct loop_device *lo, bool release) ...@@ -1398,7 +1394,6 @@ static int __loop_clr_fd(struct loop_device *lo, bool release)
blk_queue_physical_block_size(lo->lo_queue, 512); blk_queue_physical_block_size(lo->lo_queue, 512);
blk_queue_io_min(lo->lo_queue, 512); blk_queue_io_min(lo->lo_queue, 512);
if (bdev) { if (bdev) {
bdput(bdev);
invalidate_bdev(bdev); invalidate_bdev(bdev);
bdev->bd_inode->i_mapping->wb_err = 0; bdev->bd_inode->i_mapping->wb_err = 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment