s390/con3270: fix insufficient space padding
[pandora-kernel.git] / drivers / md / dm-linear.c
index 3921e3b..c55d8e4 100644 (file)
@@ -94,8 +94,8 @@ static int linear_map(struct dm_target *ti, struct bio *bio,
        return DM_MAPIO_REMAPPED;
 }
 
-static int linear_status(struct dm_target *ti, status_type_t type,
-                        char *result, unsigned int maxlen)
+static void linear_status(struct dm_target *ti, status_type_t type,
+                         char *result, unsigned maxlen)
 {
        struct linear_c *lc = (struct linear_c *) ti->private;
 
@@ -109,14 +109,23 @@ static int linear_status(struct dm_target *ti, status_type_t type,
                                (unsigned long long)lc->start);
                break;
        }
-       return 0;
 }
 
 static int linear_ioctl(struct dm_target *ti, unsigned int cmd,
                        unsigned long arg)
 {
        struct linear_c *lc = (struct linear_c *) ti->private;
-       return __blkdev_driver_ioctl(lc->dev->bdev, lc->dev->mode, cmd, arg);
+       struct dm_dev *dev = lc->dev;
+       int r = 0;
+
+       /*
+        * Only pass ioctls through if the device sizes match exactly.
+        */
+       if (lc->start ||
+           ti->len != i_size_read(dev->bdev->bd_inode) >> SECTOR_SHIFT)
+               r = scsi_verify_blk_ioctl(NULL, cmd);
+
+       return r ? : __blkdev_driver_ioctl(dev->bdev, dev->mode, cmd, arg);
 }
 
 static int linear_merge(struct dm_target *ti, struct bvec_merge_data *bvm,
@@ -144,7 +153,7 @@ static int linear_iterate_devices(struct dm_target *ti,
 
 static struct target_type linear_target = {
        .name   = "linear",
-       .version = {1, 1, 0},
+       .version = {1, 1, 1},
        .module = THIS_MODULE,
        .ctr    = linear_ctr,
        .dtr    = linear_dtr,