aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeil Brown <neilb@notabene.brown>2008-06-27 18:31:43 -0400
committerNeil Brown <neilb@notabene.brown>2008-06-27 18:31:43 -0400
commita99ac97113d5bc25ddc4d17f404c2024ac6c57f9 (patch)
treeb1848af670eb9f67961f7abc7cd5a19a07b9b37e
parent72a23c211e4587859d5bf61ac4962d76e593fb02 (diff)
Make sure all changes to md/degraded are notified.
When a device fails, when a spare is activated, when an array is reshaped, or when an array is started, the extent to which the array is degraded can change. Signed-off-by: Neil Brown <neilb@suse.de>
-rw-r--r--Documentation/md.txt7
-rw-r--r--drivers/md/md.c6
2 files changed, 12 insertions, 1 deletions
diff --git a/Documentation/md.txt b/Documentation/md.txt
index c05bfb55659e..eb6e69e3732e 100644
--- a/Documentation/md.txt
+++ b/Documentation/md.txt
@@ -392,6 +392,13 @@ also have
392 achieved. In that case, the transition to "recover" isn't 392 achieved. In that case, the transition to "recover" isn't
393 notified, but the transition away is. 393 notified, but the transition away is.
394 394
395 degraded
396 This contains a count of the number of devices by which the
397 arrays is degraded. So an optimal array with show '0'. A
398 single failed/missing drive will show '1', etc.
399 This file responds to select/poll, any increase or decrease
400 in the count of missing devices will trigger an event.
401
395 mismatch_count 402 mismatch_count
396 When performing 'check' and 'repair', and possibly when 403 When performing 'check' and 'repair', and possibly when
397 performing 'resync', md will count the number of errors that are 404 performing 'resync', md will count the number of errors that are
diff --git a/drivers/md/md.c b/drivers/md/md.c
index c26dcad8a3ac..60d4cad88c20 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -2969,6 +2969,7 @@ action_store(mddev_t *mddev, const char *page, size_t len)
2969 err = mddev->pers->start_reshape(mddev); 2969 err = mddev->pers->start_reshape(mddev);
2970 if (err) 2970 if (err)
2971 return err; 2971 return err;
2972 sysfs_notify(&mddev->kobj, NULL, "degraded");
2972 } else { 2973 } else {
2973 if (cmd_match(page, "check")) 2974 if (cmd_match(page, "check"))
2974 set_bit(MD_RECOVERY_CHECK, &mddev->recovery); 2975 set_bit(MD_RECOVERY_CHECK, &mddev->recovery);
@@ -3686,6 +3687,7 @@ static int do_md_run(mddev_t * mddev)
3686 md_new_event(mddev); 3687 md_new_event(mddev);
3687 sysfs_notify(&mddev->kobj, NULL, "array_state"); 3688 sysfs_notify(&mddev->kobj, NULL, "array_state");
3688 sysfs_notify(&mddev->kobj, NULL, "sync_action"); 3689 sysfs_notify(&mddev->kobj, NULL, "sync_action");
3690 sysfs_notify(&mddev->kobj, NULL, "degraded");
3689 kobject_uevent(&mddev->gendisk->dev.kobj, KOBJ_CHANGE); 3691 kobject_uevent(&mddev->gendisk->dev.kobj, KOBJ_CHANGE);
3690 return 0; 3692 return 0;
3691} 3693}
@@ -6049,7 +6051,9 @@ void md_check_recovery(mddev_t *mddev)
6049 if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery)) { 6051 if (!test_bit(MD_RECOVERY_INTR, &mddev->recovery)) {
6050 /* success...*/ 6052 /* success...*/
6051 /* activate any spares */ 6053 /* activate any spares */
6052 mddev->pers->spare_active(mddev); 6054 if (mddev->pers->spare_active(mddev))
6055 sysfs_notify(&mddev->kobj, NULL,
6056 "degraded");
6053 } 6057 }
6054 md_update_sb(mddev, 1); 6058 md_update_sb(mddev, 1);
6055 6059