aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/dm-linear.c8
-rw-r--r--drivers/md/dm-mpath.c13
2 files changed, 17 insertions, 4 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
111static struct target_type linear_target = { 117static struct target_type linear_target = {
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index dcfbf830964c..fb9582ae6b2d 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,
1273 struct multipath *m = (struct multipath *) ti->private; 1273 struct multipath *m = (struct multipath *) ti->private;
1274 struct block_device *bdev = NULL; 1274 struct block_device *bdev = NULL;
1275 unsigned long flags; 1275 unsigned long flags;
1276 struct file fake_file = {};
1277 struct dentry fake_dentry = {};
1276 int r = 0; 1278 int r = 0;
1277 1279
1280 fake_file.f_dentry = &fake_dentry;
1281
1278 spin_lock_irqsave(&m->lock, flags); 1282 spin_lock_irqsave(&m->lock, flags);
1279 1283
1280 if (!m->current_pgpath) 1284 if (!m->current_pgpath)
1281 __choose_pgpath(m); 1285 __choose_pgpath(m);
1282 1286
1283 if (m->current_pgpath) 1287 if (m->current_pgpath) {
1284 bdev = m->current_pgpath->path.dev->bdev; 1288 bdev = m->current_pgpath->path.dev->bdev;
1289 fake_dentry.d_inode = bdev->bd_inode;
1290 fake_file.f_mode = m->current_pgpath->path.dev->mode;
1291 }
1285 1292
1286 if (m->queue_io) 1293 if (m->queue_io)
1287 r = -EAGAIN; 1294 r = -EAGAIN;
@@ -1290,8 +1297,8 @@ static int multipath_ioctl(struct dm_target *ti, struct inode *inode,
1290 1297
1291 spin_unlock_irqrestore(&m->lock, flags); 1298 spin_unlock_irqrestore(&m->lock, flags);
1292 1299
1293 return r ? : blkdev_driver_ioctl(bdev->bd_inode, filp, bdev->bd_disk, 1300 return r ? : blkdev_driver_ioctl(bdev->bd_inode, &fake_file,
1294 cmd, arg); 1301 bdev->bd_disk, cmd, arg);
1295} 1302}
1296 1303
1297/*----------------------------------------------------------------- 1304/*-----------------------------------------------------------------