Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Mikulas Patocka and committed by
Alasdair G Kergon
1e5554c8 6bbf79a1

+7 -1
+7 -1
drivers/md/dm-snap.c
··· 1899 1899 iterate_devices_callout_fn fn, void *data) 1900 1900 { 1901 1901 struct dm_snapshot *snap = ti->private; 1902 + int r; 1902 1903 1903 - return fn(ti, snap->origin, 0, ti->len, data); 1904 + r = fn(ti, snap->origin, 0, ti->len, data); 1905 + 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