aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-mpath.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md/dm-mpath.c')
-rw-r--r--drivers/md/dm-mpath.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index 93f701ea87bc..14cfdb538efd 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -1266,12 +1266,39 @@ error:
1266 return -EINVAL; 1266 return -EINVAL;
1267} 1267}
1268 1268
1269static int multipath_ioctl(struct dm_target *ti, struct inode *inode,
1270 struct file *filp, unsigned int cmd,
1271 unsigned long arg)
1272{
1273 struct multipath *m = (struct multipath *) ti->private;
1274 struct block_device *bdev = NULL;
1275 unsigned long flags;
1276 int r = 0;
1277
1278 spin_lock_irqsave(&m->lock, flags);
1279
1280 if (!m->current_pgpath)
1281 __choose_pgpath(m);
1282
1283 if (m->current_pgpath)
1284 bdev = m->current_pgpath->path.dev->bdev;
1285
1286 if (m->queue_io)
1287 r = -EAGAIN;
1288 else if (!bdev)
1289 r = -EIO;
1290
1291 spin_unlock_irqrestore(&m->lock, flags);
1292
1293 return r ? : blkdev_ioctl(bdev->bd_inode, filp, cmd, arg);
1294}
1295
1269/*----------------------------------------------------------------- 1296/*-----------------------------------------------------------------
1270 * Module setup 1297 * Module setup
1271 *---------------------------------------------------------------*/ 1298 *---------------------------------------------------------------*/
1272static struct target_type multipath_target = { 1299static struct target_type multipath_target = {
1273 .name = "multipath", 1300 .name = "multipath",
1274 .version = {1, 0, 4}, 1301 .version = {1, 0, 5},
1275 .module = THIS_MODULE, 1302 .module = THIS_MODULE,
1276 .ctr = multipath_ctr, 1303 .ctr = multipath_ctr,
1277 .dtr = multipath_dtr, 1304 .dtr = multipath_dtr,
@@ -1281,6 +1308,7 @@ static struct target_type multipath_target = {
1281 .resume = multipath_resume, 1308 .resume = multipath_resume,
1282 .status = multipath_status, 1309 .status = multipath_status,
1283 .message = multipath_message, 1310 .message = multipath_message,
1311 .ioctl = multipath_ioctl,
1284}; 1312};
1285 1313
1286static int __init dm_multipath_init(void) 1314static int __init dm_multipath_init(void)