Commit f2a371c5 authored by NeilBrown's avatar NeilBrown

md: notify the 'degraded' sysfs attribute on failure.

We currently only 'notify' changes to the 'degraded' attribute
when it decreases, not when it increases.

Notifying on failure is a little awkward as it happen in
interrupt context.
So instead, notify when we remove the failed device from the array,
which is very soon afterwards.
Reported-and-tested-by: default avatarMikhail Balabin <mbalabin@gmail.com>
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent 19d67169
...@@ -7383,6 +7383,7 @@ static int remove_and_add_spares(struct mddev *mddev) ...@@ -7383,6 +7383,7 @@ static int remove_and_add_spares(struct mddev *mddev)
{ {
struct md_rdev *rdev; struct md_rdev *rdev;
int spares = 0; int spares = 0;
int removed = 0;
mddev->curr_resync_completed = 0; mddev->curr_resync_completed = 0;
...@@ -7396,8 +7397,13 @@ static int remove_and_add_spares(struct mddev *mddev) ...@@ -7396,8 +7397,13 @@ static int remove_and_add_spares(struct mddev *mddev)
mddev, rdev) == 0) { mddev, rdev) == 0) {
sysfs_unlink_rdev(mddev, rdev); sysfs_unlink_rdev(mddev, rdev);
rdev->raid_disk = -1; rdev->raid_disk = -1;
removed++;
} }
} }
if (removed)
sysfs_notify(&mddev->kobj, NULL,
"degraded");
list_for_each_entry(rdev, &mddev->disks, same_set) { list_for_each_entry(rdev, &mddev->disks, same_set) {
if (rdev->raid_disk >= 0 && if (rdev->raid_disk >= 0 &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment