From: Milan Broz <[email-masked]>

When an ioctl is performed on a device with a linear target, simply
pass it on to the underlying block device.

Note that the ioctl will pass through the filtering in blkdev_ioctl()
twice.
 
Signed-Off-By: Milan Broz <[email-masked]>
Signed-Off-By: Alasdair G Kergon <[email-masked]>

Index: linux-2.6.17/drivers/md/dm-linear.c
===================================================================
--- linux-2.6.17.orig/drivers/md/dm-linear.c	2006-06-21 17:45:16.000000000 +0100
+++ linux-2.6.17/drivers/md/dm-linear.c	2006-06-21 18:32:07.000000000 +0100
@@ -96,14 +96,25 @@ static int linear_status(struct dm_targe
 	return 0;
 }
 
+static int linear_ioctl(struct dm_target *ti, struct inode *inode,
+			struct file *filp, unsigned int cmd,
+			unsigned long arg)
+{
+	struct linear_c *lc = (struct linear_c *) ti->private;
+	struct block_device *bdev = lc->dev->bdev;
+
+	return blkdev_ioctl(bdev->bd_inode, filp, cmd, arg);
+}
+
 static struct target_type linear_target = {
 	.name   = "linear",
-	.version= {1, 0, 1},
+	.version= {1, 0, 2},
 	.module = THIS_MODULE,
 	.ctr    = linear_ctr,
 	.dtr    = linear_dtr,
 	.map    = linear_map,
 	.status = linear_status,
+	.ioctl  = linear_ioctl,
 };
 
 int __init dm_linear_init(void)