diff options
author | Christoph Hellwig | 2020-11-26 09:22:18 +0100 |
---|---|---|
committer | Jens Axboe | 2020-12-01 14:53:39 -0700 |
commit | 63d9932caecee8b0a295c608d083280b45885d10 (patch) | |
tree | 2e64ec02a9348b8456278d3c094cdfb88b6a4132 /fs/block_dev.c | |
parent | 5b56b6ed574b583b07da9d824c1eca6d67c1074e (diff) |
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 <hch@lst.de>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/block_dev.c')
-rw-r--r-- | fs/block_dev.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c index 0c533ac92e24..a2d5050c97ee 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -1462,6 +1462,7 @@ static int __blkdev_get(struct block_device *bdev, struct gendisk *disk, if (!(disk->flags & GENHD_FL_UP) || !bdev->bd_part || !bdev->bd_part->nr_sects) { __blkdev_put(whole, mode, 1); + bdput(whole); ret = -ENXIO; goto out_clear; } @@ -1744,9 +1745,10 @@ static void __blkdev_put(struct block_device *bdev, fmode_t mode, int for_part) disk->fops->release(disk, mode); } mutex_unlock(&bdev->bd_mutex); - bdput(bdev); - if (victim) + if (victim) { __blkdev_put(victim, mode, 1); + bdput(victim); + } } void blkdev_put(struct block_device *bdev, fmode_t mode) @@ -1796,6 +1798,7 @@ void blkdev_put(struct block_device *bdev, fmode_t mode) mutex_unlock(&bdev->bd_mutex); __blkdev_put(bdev, mode, 0); + bdput(bdev); put_disk_and_module(disk); } EXPORT_SYMBOL(blkdev_put); |