]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
[PATCH] get rid of struct file use in blkdev_ioctl() BLKBSZSET
authorAl Viro <al@aretha.pdmi.ras.ru>
Fri, 19 Sep 2008 07:08:13 +0000 (03:08 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 21 Oct 2008 11:49:12 +0000 (07:49 -0400)
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>
block/ioctl.c

index bd214cb37f2b892bff799207d269a33a5762fb27..14b7f2c106625ac57dbca1f9de958f96f6e33490 100644 (file)
@@ -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();