dm raid: fix reshape race on small devices
authorHeinz Mauelshagen <heinzm@redhat.com>
Thu, 6 Sep 2018 16:33:38 +0000 (18:33 +0200)
committerMike Snitzer <snitzer@redhat.com>
Thu, 6 Sep 2018 18:11:00 +0000 (14:11 -0400)
commit38b0bd0cda07d34ad6f145fce675ead74739c44e
tree1d311a77de85a638e010bc67a5b60c7ab75065ee
parent432061b3da64e488be3403124a72a9250bbe96d4
dm raid: fix reshape race on small devices

Loading a new mapping table, the dm-raid target's constructor
retrieves the volatile reshaping state from the raid superblocks.

When the new table is activated in a following resume, the actual
reshape position is retrieved.  The reshape driven by the previous
mapping can already have finished on small and/or fast devices thus
updating raid superblocks about the new raid layout.

This causes the actual array state (e.g. stripe size reshape finished)
to be inconsistent with the one in the new mapping, causing hangs with
left behind devices.

This race does not occur with usual raid device sizes but with small
ones (e.g. those created by the lvm2 test suite).

Fix by no longer transferring stale/inconsistent raid_set state during
preresume.

Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
drivers/md/dm-raid.c