diff options
author | Milan Broz <mbroz@redhat.com> | 2006-10-03 04:15:22 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-03 11:04:13 -0400 |
commit | e90dae1f58d475b71bcc4eebf6d4fd5217ed85c7 (patch) | |
tree | 7131716d3889636fce72009f64cd6f65ed7e324c /drivers/md/dm-linear.c | |
parent | 7006f6eca874cd44d37ccb8cfeb8bed04e3bff22 (diff) |
[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-linear.c')
-rw-r--r-- | drivers/md/dm-linear.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/md/dm-linear.c b/drivers/md/dm-linear.c index 2a6bad451f86..00234909b3db 100644 --- a/drivers/md/dm-linear.c +++ b/drivers/md/dm-linear.c | |||
@@ -104,8 +104,14 @@ static int linear_ioctl(struct dm_target *ti, struct inode *inode, | |||
104 | { | 104 | { |
105 | struct linear_c *lc = (struct linear_c *) ti->private; | 105 | struct linear_c *lc = (struct linear_c *) ti->private; |
106 | struct block_device *bdev = lc->dev->bdev; | 106 | struct block_device *bdev = lc->dev->bdev; |
107 | struct file fake_file = {}; | ||
108 | struct dentry fake_dentry = {}; | ||
107 | 109 | ||
108 | return blkdev_driver_ioctl(bdev->bd_inode, filp, bdev->bd_disk, cmd, arg); | 110 | fake_file.f_mode = lc->dev->mode; |
111 | fake_file.f_dentry = &fake_dentry; | ||
112 | fake_dentry.d_inode = bdev->bd_inode; | ||
113 | |||
114 | return blkdev_driver_ioctl(bdev->bd_inode, &fake_file, bdev->bd_disk, cmd, arg); | ||
109 | } | 115 | } |
110 | 116 | ||
111 | static struct target_type linear_target = { | 117 | static struct target_type linear_target = { |