From: Al Viro Date: Fri, 19 Sep 2008 07:08:13 +0000 (-0400) Subject: [PATCH] get rid of struct file use in blkdev_ioctl() BLKBSZSET X-Git-Tag: v2.6.28-rc1~23^2~1 X-Git-Url: http://www.pilppa.org/gitweb/gitweb.cgi?p=linux-2.6-omap-h63xx.git;a=commitdiff_plain;h=6af3a56e1dd4d95836a47214e5c60d5b749a5501 [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 --- 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();