Commit 2cd54d9b authored by Mike Anderson's avatar Mike Anderson Committed by Linus Torvalds

dm: allow offline devices

Allow check_device_area to succeed if a device has an i_size of zero.  This
addresses an issue seen on DASD devices setting up a multipath table for paths
in online and offline state.
Signed-off-by: default avatarMike Anderson <andmike@us.ibm.com>
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 79eb885c
...@@ -425,13 +425,15 @@ static void close_dev(struct dm_dev *d, struct mapped_device *md) ...@@ -425,13 +425,15 @@ static void close_dev(struct dm_dev *d, struct mapped_device *md)
} }
/* /*
* If possible (ie. blk_size[major] is set), this checks an area * If possible, this checks an area of a destination device is valid.
* of a destination device is valid.
*/ */
static int check_device_area(struct dm_dev *dd, sector_t start, sector_t len) static int check_device_area(struct dm_dev *dd, sector_t start, sector_t len)
{ {
sector_t dev_size; sector_t dev_size = dd->bdev->bd_inode->i_size >> SECTOR_SHIFT;
dev_size = dd->bdev->bd_inode->i_size >> SECTOR_SHIFT;
if (!dev_size)
return 1;
return ((start < dev_size) && (len <= (dev_size - start))); return ((start < dev_size) && (len <= (dev_size - start)));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment