diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2010-08-11 23:13:50 -0400 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2010-08-11 23:13:50 -0400 |
commit | 1e5554c8428bc7209a83e2d07ca724be4d981ce3 (patch) | |
tree | c434fd684132ae502880dc745b1982fc3ca94db0 /drivers/md | |
parent | 6bbf79a14080a0c61212f53b4b87dc1a99fedf9c (diff) |
dm snapshot: iterate origin and cow devices
Iterate both origin and snapshot devices
iterate_devices method should call the callback for all the devices where
the bio may be remapped. Thus, snapshot_iterate_devices should call the callback
for both snapshot and origin underlying devices because it remaps some bios
to the snapshot and some to the origin.
snapshot_iterate_devices called the callback only for the origin device.
This led to badly calculated device limits if snapshot and origin were placed
on different types of disks.
Cc: stable@kernel.org
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Reviewed-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-snap.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/md/dm-snap.c b/drivers/md/dm-snap.c index 54853773510c..a6ab98920cc3 100644 --- a/drivers/md/dm-snap.c +++ b/drivers/md/dm-snap.c | |||
@@ -1899,8 +1899,14 @@ static int snapshot_iterate_devices(struct dm_target *ti, | |||
1899 | iterate_devices_callout_fn fn, void *data) | 1899 | iterate_devices_callout_fn fn, void *data) |
1900 | { | 1900 | { |
1901 | struct dm_snapshot *snap = ti->private; | 1901 | struct dm_snapshot *snap = ti->private; |
1902 | int r; | ||
1903 | |||
1904 | r = fn(ti, snap->origin, 0, ti->len, data); | ||
1902 | 1905 | ||
1903 | return fn(ti, snap->origin, 0, ti->len, data); | 1906 | if (!r) |
1907 | r = fn(ti, snap->cow, 0, get_dev_size(snap->cow->bdev), data); | ||
1908 | |||
1909 | return r; | ||
1904 | } | 1910 | } |
1905 | 1911 | ||
1906 | 1912 | ||