Skip to content

Commit

Permalink
[PATCH] md: make sure the events count in an md array never returns t…
Browse files Browse the repository at this point in the history
…o 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: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
NeilBrown authored and Linus Torvalds committed Jan 26, 2007
1 parent 3eda22d commit 1031be7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -1633,7 +1633,8 @@ static void md_update_sb(mddev_t * mddev, int force_change)
* 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 ... */
Expand Down

0 comments on commit 1031be7

Please sign in to comment.