diff options
-rw-r--r-- | block/ioctl.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/block/ioctl.c b/block/ioctl.c index bd214cb37f2b..14b7f2c10662 100644 --- a/block/ioctl.c +++ b/block/ioctl.c | |||
@@ -343,10 +343,11 @@ int blkdev_ioctl(struct inode *inode, struct file *file, unsigned cmd, | |||
343 | return -EINVAL; | 343 | return -EINVAL; |
344 | if (get_user(n, (int __user *) arg)) | 344 | if (get_user(n, (int __user *) arg)) |
345 | return -EFAULT; | 345 | return -EFAULT; |
346 | if (bd_claim(bdev, file) < 0) | 346 | if (!(mode & FMODE_EXCL) && bd_claim(bdev, &bdev) < 0) |
347 | return -EBUSY; | 347 | return -EBUSY; |
348 | ret = set_blocksize(bdev, n); | 348 | ret = set_blocksize(bdev, n); |
349 | bd_release(bdev); | 349 | if (!(mode & FMODE_EXCL)) |
350 | bd_release(bdev); | ||
350 | return ret; | 351 | return ret; |
351 | case BLKPG: | 352 | case BLKPG: |
352 | lock_kernel(); | 353 | lock_kernel(); |