Skip to content

Commit

Permalink
dm: allow offline devices
Browse files Browse the repository at this point in the history
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: Mike Anderson <andmike@us.ibm.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Mike Anderson authored and Linus Torvalds committed May 9, 2007
1 parent 79eb885 commit 2cd54d9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions drivers/md/dm-table.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
* of a destination device is valid.
* If possible, this checks an area of a destination device is valid.
*/
static int check_device_area(struct dm_dev *dd, sector_t start, sector_t len)
{
sector_t dev_size;
dev_size = dd->bdev->bd_inode->i_size >> SECTOR_SHIFT;
sector_t dev_size = dd->bdev->bd_inode->i_size >> SECTOR_SHIFT;

if (!dev_size)
return 1;

return ((start < dev_size) && (len <= (dev_size - start)));
}

Expand Down

0 comments on commit 2cd54d9

Please sign in to comment.