Skip to content

Commit 63d9932

Browse files
Christoph Hellwigaxboe
authored andcommitted
block: move bdput() to the callers of __blkdev_get
This will allow for a more symmetric calling convention going forward. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Jan Kara <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
1 parent 5b56b6e commit 63d9932

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

fs/block_dev.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1462,6 +1462,7 @@ static int __blkdev_get(struct block_device *bdev, struct gendisk *disk,
14621462
if (!(disk->flags & GENHD_FL_UP) ||
14631463
!bdev->bd_part || !bdev->bd_part->nr_sects) {
14641464
__blkdev_put(whole, mode, 1);
1465+
bdput(whole);
14651466
ret = -ENXIO;
14661467
goto out_clear;
14671468
}
@@ -1744,9 +1745,10 @@ static void __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part)
17441745
disk->fops->release(disk, mode);
17451746
}
17461747
mutex_unlock(&bdev->bd_mutex);
1747-
bdput(bdev);
1748-
if (victim)
1748+
if (victim) {
17491749
__blkdev_put(victim, mode, 1);
1750+
bdput(victim);
1751+
}
17501752
}
17511753

17521754
void blkdev_put(struct block_device *bdev, fmode_t mode)
@@ -1796,6 +1798,7 @@ void blkdev_put(struct block_device *bdev, fmode_t mode)
17961798
mutex_unlock(&bdev->bd_mutex);
17971799

17981800
__blkdev_put(bdev, mode, 0);
1801+
bdput(bdev);
17991802
put_disk_and_module(disk);
18001803
}
18011804
EXPORT_SYMBOL(blkdev_put);

0 commit comments

Comments
 (0)