summaryrefslogtreecommitdiff
path: root/block/ioctl.c
diff options
context:
space:
mode:
authorJan Kara <jack@suse.cz>2023-09-27 11:34:09 +0200
committerChristian Brauner <brauner@kernel.org>2023-10-28 13:29:16 +0200
commitacb083b55597872dcaebe9e0352da7fdf1684def (patch)
tree4501cc459df35ccbbaa9e7c61bb26dea354aeddf /block/ioctl.c
parent841dd789b8625eb9288aaa2be9f10872e6622033 (diff)
block: Use bdev_open_by_dev() in disk_scan_partitions() and blkdev_bszset()
Convert disk_scan_partitions() and blkdev_bszset() to use bdev_open_by_dev(). Acked-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Christian Brauner <brauner@kernel.org> Signed-off-by: Jan Kara <jack@suse.cz> Link: https://lore.kernel.org/r/20230927093442.25915-3-jack@suse.cz Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'block/ioctl.c')
-rw-r--r--block/ioctl.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/block/ioctl.c b/block/ioctl.c
index d5f5cd61efd7..5d356c964352 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -467,6 +467,7 @@ static int blkdev_bszset(struct block_device *bdev, blk_mode_t mode,
int __user *argp)
{
int ret, n;
+ struct bdev_handle *handle;
if (!capable(CAP_SYS_ADMIN))
return -EACCES;
@@ -478,10 +479,11 @@ static int blkdev_bszset(struct block_device *bdev, blk_mode_t mode,
if (mode & BLK_OPEN_EXCL)
return set_blocksize(bdev, n);
- if (IS_ERR(blkdev_get_by_dev(bdev->bd_dev, mode, &bdev, NULL)))
+ handle = bdev_open_by_dev(bdev->bd_dev, mode, &bdev, NULL);
+ if (IS_ERR(handle))
return -EBUSY;
ret = set_blocksize(bdev, n);
- blkdev_put(bdev, &bdev);
+ bdev_release(handle);
return ret;
}