]> www.infradead.org Git - users/hch/block.git/commitdiff
loop: don't grab a reference to the block device
authorChristoph Hellwig <hch@lst.de>
Tue, 29 Jun 2021 11:42:08 +0000 (13:42 +0200)
committerChristoph Hellwig <hch@lst.de>
Wed, 21 Jul 2021 06:32:07 +0000 (08:32 +0200)
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.

drivers/block/loop.c

index f37b9e3d833c226a4f335296d53ccd99cdab18c7..62c5120cf7443d42b4e576ec6705cc22010a3ce9 100644 (file)
@@ -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;
        }