diff mbox series

[7/9] loop: don't grab a reference to the block device

Message ID 20210722075402.983367-8-hch@lst.de (mailing list archive)
State New, archived
Headers show
Series [1/9] block: delay freeing the gendisk | expand

Commit Message

Christoph Hellwig July 22, 2021, 7:54 a.m. UTC
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: Christoph Hellwig <hch@lst.de>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
---
 drivers/block/loop.c | 5 -----
 1 file changed, 5 deletions(-)

Comments

Ming Lei July 22, 2021, 8:57 a.m. UTC | #1
On Thu, Jul 22, 2021 at 09:54:00AM +0200, Christoph Hellwig wrote:
> 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: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Josef Bacik <josef@toxicpanda.com>

Reviewed-by: Ming Lei <ming.lei@rehat.com>
Chaitanya Kulkarni July 22, 2021, 6:40 p.m. UTC | #2
On 7/22/2021 12:54 AM, Christoph Hellwig wrote:
> 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: Christoph Hellwig<hch@lst.de>
> Reviewed-by: Josef Bacik<josef@toxicpanda.com>

Reviewed-by: Chaitanya Kulkarni <ckulkarnilinux@gmail.com>
diff mbox series

Patch

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index f37b9e3d833c..62c5120cf744 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1249,10 +1249,6 @@  static int loop_configure(struct loop_device *lo, fmode_t mode,
 	if (partscan)
 		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);
 	mutex_unlock(&lo->lo_mutex);
 	if (partscan)
 		loop_reread_partitions(lo);
@@ -1332,7 +1328,6 @@  static int __loop_clr_fd(struct loop_device *lo, bool release)
 	blk_queue_physical_block_size(lo->lo_queue, 512);
 	blk_queue_io_min(lo->lo_queue, 512);
 	if (bdev) {
-		bdput(bdev);
 		invalidate_bdev(bdev);
 		bdev->bd_inode->i_mapping->wb_err = 0;
 	}