Commit 1031be7a authored by NeilBrown's avatar NeilBrown Committed by Linus Torvalds

[PATCH] md: make sure the events count in an md array never returns to zero

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: default avatarNeil Brown <neilb@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 3eda22d1
...@@ -1633,7 +1633,8 @@ repeat: ...@@ -1633,7 +1633,8 @@ repeat:
* and 'events' is odd, we can roll back to the previous clean state */ * and 'events' is odd, we can roll back to the previous clean state */
if (nospares if (nospares
&& (mddev->in_sync && mddev->recovery_cp == MaxSector) && (mddev->in_sync && mddev->recovery_cp == MaxSector)
&& (mddev->events & 1)) && (mddev->events & 1)
&& mddev->events != 1)
mddev->events--; mddev->events--;
else { else {
/* otherwise we have to go forward and ... */ /* otherwise we have to go forward and ... */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment