[dm-devel] [PATCH 1 of 2] dm-raid: set recovery flags on resume

Jonathan Brassow jbrassow at redhat.com
Mon Apr 16 23:45:35 UTC 2012


Set recovery flags so that recovery restarts when DM device is resumed.

When a device-mapper device is suspended, all I/O must stop.  This is done by
calling 'md_stop_writes' and 'mddev_suspend'.  These calls in-turn manipulate
the recovery flags - including setting 'MD_RECOVERY_FROZEN'.  The DM device
may have been suspended while recovery was not yet complete, so the process
needs to pick-up where it left off.  Since 'mddev_resume' does not unset
'MD_RECOVERY_FROZEN' and set 'MD_RECOVERY_NEEDED', we must do it ourselves before
calling 'mddev_resume'.

Signed-off-by: Jonathan Brassow <jbrassow at redhat.com>

Index: linux-upstream/drivers/md/dm-raid.c
===================================================================
--- linux-upstream.orig/drivers/md/dm-raid.c
+++ linux-upstream/drivers/md/dm-raid.c
@@ -1255,9 +1255,11 @@ static void raid_resume(struct dm_target
 	if (!rs->bitmap_loaded) {
 		bitmap_load(&rs->md);
 		rs->bitmap_loaded = 1;
-	} else
+	} else {
+		set_bit(MD_RECOVERY_NEEDED, &rs->md.recovery);
+		clear_bit(MD_RECOVERY_FROZEN, &rs->md.recovery);
 		md_wakeup_thread(rs->md.thread);
-
+	}
 	mddev_resume(&rs->md);
 }
 





More information about the dm-devel mailing list