diff options
author | Milan Broz <mbroz@redhat.com> | 2006-10-03 01:15:20 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-03 08:04:13 -0700 |
commit | 9af4aa30b713a58e5952045f52c41a6e3baa2fdc (patch) | |
tree | 87702659749a6db94ec32a829867e080b419bc82 /drivers/md/dm-mpath.c | |
parent | ab17ffa440cb54ca64111fa4922ba12496fcc8af (diff) | |
download | linux-9af4aa30b713a58e5952045f52c41a6e3baa2fdc.tar.bz2 |
[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/dm-mpath.c')
-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: return -EINVAL; } +static int multipath_ioctl(struct dm_target *ti, struct inode *inode, + struct file *filp, unsigned int cmd, + unsigned long arg) +{ + struct multipath *m = (struct multipath *) ti->private; + struct block_device *bdev = NULL; + unsigned long flags; + int r = 0; + + spin_lock_irqsave(&m->lock, flags); + + if (!m->current_pgpath) + __choose_pgpath(m); + + if (m->current_pgpath) + bdev = m->current_pgpath->path.dev->bdev; + + if (m->queue_io) + r = -EAGAIN; + else if (!bdev) + r = -EIO; + + spin_unlock_irqrestore(&m->lock, flags); + + return r ? : blkdev_ioctl(bdev->bd_inode, filp, cmd, arg); +} + /*----------------------------------------------------------------- * Module setup *---------------------------------------------------------------*/ static struct target_type multipath_target = { .name = "multipath", - .version = {1, 0, 4}, + .version = {1, 0, 5}, .module = THIS_MODULE, .ctr = multipath_ctr, .dtr = multipath_dtr, @@ -1281,6 +1308,7 @@ static struct target_type multipath_target = { .resume = multipath_resume, .status = multipath_status, .message = multipath_message, + .ioctl = multipath_ioctl, }; static int __init dm_multipath_init(void) |