1
0
Fork 0

[PATCH] get rid of struct file use in blkdev_ioctl() BLKBSZSET

We need to do bd_claim() only if file hadn't been opened with O_EXCL
and then we have no need to use file itself as owner.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
hifive-unleashed-5.1
Al Viro 2008-09-19 03:08:13 -04:00 committed by Al Viro
parent 45048d0961
commit 6af3a56e1d
1 changed files with 3 additions and 2 deletions

View File

@ -343,10 +343,11 @@ int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd,
return -EINVAL;
if (get_user(n, (int __user *) arg))
return -EFAULT;
if (bd_claim(bdev, file) < 0)
if (!(mode & FMODE_EXCL) && bd_claim(bdev, &bdev) < 0)
return -EBUSY;
ret = set_blocksize(bdev, n);
bd_release(bdev);
if (!(mode & FMODE_EXCL))
bd_release(bdev);
return ret;
case BLKPG:
lock_kernel();