summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/ioctl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/block/ioctl.c b/block/ioctl.c
index bd214cb..14b7f2c 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();
OpenPOWER on IntegriCloud