Skip to content

Commit

Permalink
[PATCH] get rid of struct file use in blkdev_ioctl() BLKBSZSET
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Al Viro authored and Al Viro committed Oct 21, 2008
1 parent 45048d0 commit 6af3a56
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions block/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 6af3a56

Please sign in to comment.