diff mbox series

[3/5] dm-raid: correct explicit superblock update requests

Message ID 62c2b6e2f3fd78591c15144970791416a9012a55.1536167421.git.heinzm@redhat.com (mailing list archive)
State Superseded, archived
Delegated to: Mike Snitzer
Headers show
Series dm raid: deadlock/corruptor fixes | expand

Commit Message

Heinz Mauelshagen Sept. 5, 2018, 5:36 p.m. UTC
Critical:

Request superblock updates when particular devices are requested
to be rebuild (e.g. via lvconvert --replace ...) to avoid racy
"New device injected into existing raid set without 'delta_disks'
 or 'rebuild' parameter specified" kernel error messages.

Cleanup:

Remove request to write superblocks in super_load() when new,
because raid_ctr() requests it already via flag RT_FLAG_UPDATE_SBS
for new arrays (it's performed in preresume).

Avoid explicit superblocks update in rs_start_reshape() because
it's already requested before for new reshapes in
rs_prepare_reshape().

Signed-off-by: Heinz Mauelshagen <heinzm@redhat.com>
---
 drivers/md/dm-raid.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)
diff mbox series

Patch

diff --git a/drivers/md/dm-raid.c b/drivers/md/dm-raid.c
index 03dd915eff9e..efe035fcb23e 100644
--- a/drivers/md/dm-raid.c
+++ b/drivers/md/dm-raid.c
@@ -2202,9 +2202,6 @@  static int super_load(struct md_rdev *rdev, struct md_rdev *refdev)
 		set_bit(FirstUse, &rdev->flags);
 		sb->compat_features = cpu_to_le32(FEATURE_FLAG_SUPPORTS_V190);
 
-		/* Force writing of superblocks to disk */
-		set_bit(MD_SB_CHANGE_DEVS, &rdev->mddev->sb_flags);
-
 		/* Any superblock is better than none, choose that if given */
 		return refdev ? 0 : 1;
 	}
@@ -3126,6 +3123,11 @@  static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 		set_bit(RT_FLAG_UPDATE_SBS, &rs->runtime_flags);
 		rs_set_new(rs);
 	} else if (rs_is_recovering(rs)) {
+		/* Rebuild particular devices */
+		if (test_bit(__CTR_FLAG_REBUILD, &rs->ctr_flags)) {
+			set_bit(RT_FLAG_UPDATE_SBS, &rs->runtime_flags);
+			rs_setup_recovery(rs, MaxSector);
+		}
 		/* A recovering raid set may be resized */
 		; /* skip setup rs */
 	} else if (rs_is_reshaping(rs)) {
@@ -3234,7 +3236,6 @@  static int raid_ctr(struct dm_target *ti, unsigned int argc, char **argv)
 	}
 
 	r = md_start(&rs->md);
-
 	if (r) {
 		ti->error = "Failed to start raid array";
 		mddev_unlock(&rs->md);
@@ -3846,7 +3847,7 @@  static int __load_dirty_region_bitmap(struct raid_set *rs)
 	return r;
 }
 
-/* Enforce updating all superblocks */
+/* Enforce updating new superblocks */
 static void rs_update_sbs(struct raid_set *rs)
 {
 	struct mddev *mddev = &rs->md;
@@ -3901,13 +3902,6 @@  static int rs_start_reshape(struct raid_set *rs)
 		}
 	}
 
-	/*
-	 * Now reshape got set up, update superblocks to
-	 * reflect the fact so that a table reload will
-	 * access proper superblock content in the ctr.
-	 */
-	rs_update_sbs(rs);
-
 	return 0;
 }