summaryrefslogtreecommitdiffstats
path: root/block/ioctl.c
diff options
context:
space:
mode:
authorJoel Becker <jlbec@evilplan.org>2011-03-28 09:44:26 -0700
committerJoel Becker <jlbec@evilplan.org>2011-03-28 09:44:26 -0700
commit99bdc3880c611c7f2061fbd5372ef81b40217e26 (patch)
treeef68a53e28e9ee53ce9db3642bab5fa5b3d44866 /block/ioctl.c
parented59992e8d91b70053c53d846a76f7e1ac000454 (diff)
parentb4e1b7e88b2c87c358c2a88bec0c76d25accc604 (diff)
Merge branch 'mlog_replace_for_39' of git://repo.or.cz/taoma-kernel into ocfs2-merge-window-fix
Diffstat (limited to 'block/ioctl.c')
-rw-r--r--block/ioctl.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/block/ioctl.c b/block/ioctl.c
index 9049d460fa8..1124cd29726 100644
--- a/block/ioctl.c
+++ b/block/ioctl.c
@@ -294,9 +294,11 @@ int blkdev_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
return -EINVAL;
if (get_user(n, (int __user *) arg))
return -EFAULT;
- if (!(mode & FMODE_EXCL) &&
- blkdev_get(bdev, mode | FMODE_EXCL, &bdev) < 0)
- return -EBUSY;
+ if (!(mode & FMODE_EXCL)) {
+ bdgrab(bdev);
+ if (blkdev_get(bdev, mode | FMODE_EXCL, &bdev) < 0)
+ return -EBUSY;
+ }
ret = set_blocksize(bdev, n);
if (!(mode & FMODE_EXCL))
blkdev_put(bdev, mode | FMODE_EXCL);