mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-29 17:22:07 +00:00
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>
This commit is contained in:
parent
f3a608827d
commit
e5ca9d3916
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user