[dm-devel] [PATCH] dm-raid1: remove the error flags in the mirror set when it's in sync

Lidong Zhong lzhong at suse.com
Wed Apr 15 10:50:39 UTC 2015


Because it's in sync now, we can remove all kinds of error flags during
the recovery. Otherwise, it will affect the valid mirror legs and the write
bio.

Signed-off-by: Lidong Zhong <lzhong at suse.com>
---
 drivers/md/dm-raid1.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c
index 8e32c4e..95ec822 100644
--- a/drivers/md/dm-raid1.c
+++ b/drivers/md/dm-raid1.c
@@ -372,6 +372,17 @@ static int recover(struct mirror_set *ms, struct dm_region *reg)
 	return r;
 }
 
+static void reset_ms_flags(struct mirror_set *ms)
+{
+	unsigned int m;
+
+	ms->leg_failure = 0;
+	for (m = 0; m < ms->nr_mirrors; m++) {
+		atomic_set(&(ms->mirror[m].error_count), 0);
+		ms->mirror[m].error_type = 0;
+	}
+}
+
 static void do_recovery(struct mirror_set *ms)
 {
 	struct dm_region *reg;
@@ -400,6 +411,7 @@ static void do_recovery(struct mirror_set *ms)
 		/* the sync is complete */
 		dm_table_event(ms->ti->table);
 		ms->in_sync = 1;
+		reset_ms_flags(ms);
 	}
 }
 
-- 
1.8.1.4




More information about the dm-devel mailing list