summaryrefslogtreecommitdiffstats
path: root/block/ioctl.c
diff options
context:
space:
mode:
authorAl Viro <al@aretha.pdmi.ras.ru>2008-09-19 03:08:13 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2008-10-21 07:49:12 -0400
commit6af3a56e1dd4d95836a47214e5c60d5b749a5501 (patch)
tree757b01fe8668783fcf52a4e8fe82c5d8ebbc6b72 /block/ioctl.c
parent45048d0961cdbf7ddfba906797ad8cb42489e070 (diff)
[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>
Diffstat (limited to 'block/ioctl.c')
-rw-r--r--block/ioctl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/block/ioctl.c b/block/ioctl.c
index bd214cb37f2..14b7f2c1066 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -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();