md: fix raid5 'repair' operations
commit15c2419876173c417a119b5665ecc62520e50a6c
authorDan Williams <dan.j.williams@intel.com>
Tue, 13 May 2008 19:10:11 +0000 (13 19:10 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 15 May 2008 14:50:08 +0000 (15 07:50 -0700)
tree424907ed1186be3c20ad852b8ceeb0eb4c83aac3
parent69ad365afb26fa2ac1bdb4b166b6cc231251edd8
md: fix raid5 'repair' operations

commit c8894419acf5e56851de9741c5047bebd78acd1f upstream
Date: Mon, 12 May 2008 14:02:12 -0700
Subject: md: fix raid5 'repair' operations

commit bd2ab67030e9116f1e4aae1289220255412b37fd "md: close a livelock window
in handle_parity_checks5" introduced a bug in handling 'repair' operations.
After a repair operation completes we clear the state bits tracking this
operation.  However, they are cleared too early and this results in the code
deciding to re-run the parity check operation.  Since we have done the repair
in memory the second check does not find a mismatch and thus does not do a
writeback.

Test results:
$ echo repair > /sys/block/md0/md/sync_action
$ cat /sys/block/md0/md/mismatch_cnt
51072
$ echo repair > /sys/block/md0/md/sync_action
$ cat /sys/block/md0/md/mismatch_cnt
0

(also fix incorrect indentation)

Tested-by: George Spelvin <linux@horizon.com>
Acked-by: NeilBrown <neilb@suse.de>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/md/raid5.c