md: 'sync_action' in sysfs returns wrong value for readonly arrays
authorNeilBrown <neilb@suse.de>
Wed, 17 Oct 2007 06:30:53 +0000 (23:30 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Wed, 17 Oct 2007 15:43:03 +0000 (08:43 -0700)
When an array is started read-only, MD_RECOVERY_NEEDED can be set but no
recovery will be running.  This causes 'sync_action' to report the wrong
value.

We could remove the test for MD_RECOVERY_NEEDED, but doing so would leave a
small gap after requesting a sync action, where 'sync_action' would still
report the old value.

So make sure that for a read-only array, 'sync_action' always returns 'idle'.

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

index f173ace1f8fb6babbbed55ddf61e1b2aad2bfd8f..510625e3a965b26b59ef66a5578441f44ece1f8e 100644 (file)
@@ -2714,7 +2714,7 @@ action_show(mddev_t *mddev, char *page)
 {
        char *type = "idle";
        if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) ||
-           test_bit(MD_RECOVERY_NEEDED, &mddev->recovery)) {
+           (!mddev->ro && test_bit(MD_RECOVERY_NEEDED, &mddev->recovery))) {
                if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery))
                        type = "reshape";
                else if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) {