[PATCH 002 of 5] md: 'sync_action' in sysfs returns wrong value for readonly arrays

2007-10-14 Thread NeilBrown

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 <[EMAIL PROTECTED]>

### Diffstat output
 ./drivers/md/md.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff .prev/drivers/md/md.c ./drivers/md/md.c
--- .prev/drivers/md/md.c   2007-10-15 14:06:32.0 +1000
+++ ./drivers/md/md.c   2007-10-15 14:06:32.0 +1000
@@ -2714,7 +2714,7 @@ action_show(mddev_t *mddev, char *page)
 {
char *type = "idle";
if (test_bit(MD_RECOVERY_RUNNING, >recovery) ||
-   test_bit(MD_RECOVERY_NEEDED, >recovery)) {
+   (!mddev->ro && test_bit(MD_RECOVERY_NEEDED, >recovery))) {
if (test_bit(MD_RECOVERY_RESHAPE, >recovery))
type = "reshape";
else if (test_bit(MD_RECOVERY_SYNC, >recovery)) {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 002 of 5] md: 'sync_action' in sysfs returns wrong value for readonly arrays

2007-10-14 Thread NeilBrown

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 [EMAIL PROTECTED]

### Diffstat output
 ./drivers/md/md.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff .prev/drivers/md/md.c ./drivers/md/md.c
--- .prev/drivers/md/md.c   2007-10-15 14:06:32.0 +1000
+++ ./drivers/md/md.c   2007-10-15 14:06:32.0 +1000
@@ -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)) {
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/