Skip to content

Commit

Permalink
md: notify the 'degraded' sysfs attribute on failure.
Browse files Browse the repository at this point in the history
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: Mikhail Balabin <mbalabin@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
  • Loading branch information
NeilBrown committed Jan 10, 2012
1 parent 19d6716 commit f2a371c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/md/md.c
Original file line number Diff line number Diff line change
Expand Up @@ -7383,6 +7383,7 @@ static int remove_and_add_spares(struct mddev *mddev)
{
struct md_rdev *rdev;
int spares = 0;
int removed = 0;

mddev->curr_resync_completed = 0;

Expand All @@ -7396,8 +7397,13 @@ static int remove_and_add_spares(struct mddev *mddev)
mddev, rdev) == 0) {
sysfs_unlink_rdev(mddev, rdev);
rdev->raid_disk = -1;
removed++;
}
}
if (removed)
sysfs_notify(&mddev->kobj, NULL,
"degraded");


list_for_each_entry(rdev, &mddev->disks, same_set) {
if (rdev->raid_disk >= 0 &&
Expand Down

0 comments on commit f2a371c

Please sign in to comment.