diff options
author | Milan Broz <mbroz@redhat.com> | 2006-10-03 01:15:22 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-03 08:04:13 -0700 |
commit | e90dae1f58d475b71bcc4eebf6d4fd5217ed85c7 (patch) | |
tree | 7131716d3889636fce72009f64cd6f65ed7e324c /drivers/md/dm-mpath.c | |
parent | 7006f6eca874cd44d37ccb8cfeb8bed04e3bff22 (diff) | |
download | op-kernel-dev-e90dae1f58d475b71bcc4eebf6d4fd5217ed85c7.zip op-kernel-dev-e90dae1f58d475b71bcc4eebf6d4fd5217ed85c7.tar.gz |
[PATCH] dm: support ioctls on mapped devices: fix with fake file
The new ioctl code passes the wrong file pointer to the underlying device.
No file pointer is available so make a temporary fake one.
ioctl_by_bdev() does set_fs(KERNEL_DS) so it's for ioctls originating
within the kernel and unsuitable here. We are processing ioctls that
originated in userspace and mapping them to different devices. Fixing the
existing callers that pass a NULL file struct and consolidating the
fake_file users are separate matters to solve in later patches.
Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/dm-mpath.c')
-rw-r--r-- | drivers/md/dm-mpath.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c index dcfbf83..fb9582a 100644 --- a/drivers/md/dm-mpath.c +++ b/drivers/md/dm-mpath.c @@ -1273,15 +1273,22 @@ static int multipath_ioctl(struct dm_target *ti, struct inode *inode, struct multipath *m = (struct multipath *) ti->private; struct block_device *bdev = NULL; unsigned long flags; + struct file fake_file = {}; + struct dentry fake_dentry = {}; int r = 0; + fake_file.f_dentry = &fake_dentry; + spin_lock_irqsave(&m->lock, flags); if (!m->current_pgpath) __choose_pgpath(m); - if (m->current_pgpath) + if (m->current_pgpath) { bdev = m->current_pgpath->path.dev->bdev; + fake_dentry.d_inode = bdev->bd_inode; + fake_file.f_mode = m->current_pgpath->path.dev->mode; + } if (m->queue_io) r = -EAGAIN; @@ -1290,8 +1297,8 @@ static int multipath_ioctl(struct dm_target *ti, struct inode *inode, spin_unlock_irqrestore(&m->lock, flags); - return r ? : blkdev_driver_ioctl(bdev->bd_inode, filp, bdev->bd_disk, - cmd, arg); + return r ? : blkdev_driver_ioctl(bdev->bd_inode, &fake_file, + bdev->bd_disk, cmd, arg); } /*----------------------------------------------------------------- |