diff options
author | Milan Broz <mbroz@redhat.com> | 2006-10-03 04:15:20 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-03 11:04:13 -0400 |
commit | 9af4aa30b713a58e5952045f52c41a6e3baa2fdc (patch) | |
tree | 87702659749a6db94ec32a829867e080b419bc82 /drivers/md | |
parent | ab17ffa440cb54ca64111fa4922ba12496fcc8af (diff) |
[PATCH] dm mpath: support ioctls
When an ioctl is performed on a multipath device simply pass it on to the
underlying block device through current_path. If current path is not yet
selected, select it.
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')
-rw-r--r-- | drivers/md/dm-mpath.c | 30 |
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 | ||
1269 | static 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 | *---------------------------------------------------------------*/ |
1272 | static struct target_type multipath_target = { | 1299 | static 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 | ||
1286 | static int __init dm_multipath_init(void) | 1314 | static int __init dm_multipath_init(void) |