From db7c50832307d71168fcda5e39c20e9a3823440d Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Tue, 2 May 2017 23:29:42 +0000 Subject: [PATCH] Synchronize unclean mirrors before adding them to a running gmirror. During gmirror startup, if component mirrors are found to be dirty as is typical after a system crash, the mirrors are synchronized to the mirror with highest priority. However if a gmirror starts without all of its mirrors present, for example because of some transient delays during tasting, the remaining mirrors must be synchronized before they may become active. MFC after: 2 weeks Sponsored by: Dell EMC Isilon --- sys/geom/mirror/g_mirror.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/geom/mirror/g_mirror.c b/sys/geom/mirror/g_mirror.c index 826412a67007..4447ce2a2dd2 100644 --- a/sys/geom/mirror/g_mirror.c +++ b/sys/geom/mirror/g_mirror.c @@ -2225,7 +2225,9 @@ g_mirror_determine_state(struct g_mirror_disk *disk) sc = disk->d_softc; if (sc->sc_syncid == disk->d_sync.ds_syncid) { if ((disk->d_flags & - G_MIRROR_DISK_FLAG_SYNCHRONIZING) == 0) { + G_MIRROR_DISK_FLAG_SYNCHRONIZING) == 0 && + (g_mirror_ndisks(sc, G_MIRROR_DISK_STATE_ACTIVE) == 0 || + (disk->d_flags & G_MIRROR_DISK_FLAG_DIRTY) == 0)) { /* Disk does not need synchronization. */ state = G_MIRROR_DISK_STATE_ACTIVE; } else {