diff options
author | Christian Brauner <brauner@kernel.org> | 2024-01-23 14:26:19 +0100 |
---|---|---|
committer | Christian Brauner <brauner@kernel.org> | 2024-02-25 12:05:22 +0100 |
commit | e5ca9d391615269b05a6ed871fec66d9db650520 (patch) | |
tree | 962a7bfa1261e018e7e83ad3aa39f8f927d7b023 /block | |
parent | f3a608827d1f8de0dd12813e8d9c6803fe64e119 (diff) |
block/ioctl: port blkdev_bszset() to file
Link: https://lore.kernel.org/r/20240123-vfs-bdev-file-v2-2-adbd023e19cc@kernel.org
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'block')
-rw-r--r-- | block/ioctl.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/block/ioctl.c b/block/ioctl.c index 9c73a763ef88..5d0619e02e4c 100644 --- a/block/ioctl.c +++ b/block/ioctl.c @@ -471,7 +471,7 @@ static int blkdev_bszset(struct block_device *bdev, blk_mode_t mode, int __user *argp) { int ret, n; - struct bdev_handle *handle; + struct file *file; if (!capable(CAP_SYS_ADMIN)) return -EACCES; @@ -483,12 +483,11 @@ static int blkdev_bszset(struct block_device *bdev, blk_mode_t mode, if (mode & BLK_OPEN_EXCL) return set_blocksize(bdev, n); - handle = bdev_open_by_dev(bdev->bd_dev, mode, &bdev, NULL); - if (IS_ERR(handle)) + file = bdev_file_open_by_dev(bdev->bd_dev, mode, &bdev, NULL); + if (IS_ERR(file)) return -EBUSY; ret = set_blocksize(bdev, n); - bdev_release(handle); - + fput(file); return ret; } |