]> err.no Git - linux-2.6/commitdiff
[PATCH] md: make sure the events count in an md array never returns to zero
authorNeilBrown <neilb@suse.de>
Fri, 26 Jan 2007 08:57:02 +0000 (00:57 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Fri, 26 Jan 2007 21:50:59 +0000 (13:50 -0800)
Now that we sometimes step the array events count backwards (when
transitioning dirty->clean where nothing else interesting has happened - so
that we don't need to write to spares all the time), it is possible for the
event count to return to zero, which is potentially confusing and triggers and
MD_BUG.

We could possibly remove the MD_BUG, but is just as easy, and probably safer,
to make sure we never return to zero.

Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/md/md.c

index d1cb45f6d6a902c33b333957fffbaee15daa664d..ec3d8e8a0bd33422545fd15a9d4df4ec12fdf258 100644 (file)
@@ -1633,7 +1633,8 @@ repeat:
         * and 'events' is odd, we can roll back to the previous clean state */
        if (nospares
            && (mddev->in_sync && mddev->recovery_cp == MaxSector)
-           && (mddev->events & 1))
+           && (mddev->events & 1)
+           && mddev->events != 1)
                mddev->events--;
        else {
                /* otherwise we have to go forward and ... */