aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/md.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 60d4cad88c20..dc99d95a1b6d 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1886,6 +1886,8 @@ state_store(mdk_rdev_t *rdev, const char *buf, size_t len)
1886 1886
1887 err = 0; 1887 err = 0;
1888 } 1888 }
1889 if (!err)
1890 sysfs_notify(&rdev->kobj, NULL, "state");
1889 return err ? err : len; 1891 return err ? err : len;
1890} 1892}
1891static struct rdev_sysfs_entry rdev_state = 1893static struct rdev_sysfs_entry rdev_state =
@@ -1979,7 +1981,8 @@ slot_store(mdk_rdev_t *rdev, const char *buf, size_t len)
1979 if (err) { 1981 if (err) {
1980 rdev->raid_disk = -1; 1982 rdev->raid_disk = -1;
1981 return err; 1983 return err;
1982 } 1984 } else
1985 sysfs_notify(&rdev->kobj, NULL, "state");
1983 sprintf(nm, "rd%d", rdev->raid_disk); 1986 sprintf(nm, "rd%d", rdev->raid_disk);
1984 if (sysfs_create_link(&rdev->mddev->kobj, &rdev->kobj, nm)) 1987 if (sysfs_create_link(&rdev->mddev->kobj, &rdev->kobj, nm))
1985 printk(KERN_WARNING 1988 printk(KERN_WARNING
@@ -1996,6 +1999,7 @@ slot_store(mdk_rdev_t *rdev, const char *buf, size_t len)
1996 clear_bit(Faulty, &rdev->flags); 1999 clear_bit(Faulty, &rdev->flags);
1997 clear_bit(WriteMostly, &rdev->flags); 2000 clear_bit(WriteMostly, &rdev->flags);
1998 set_bit(In_sync, &rdev->flags); 2001 set_bit(In_sync, &rdev->flags);
2002 sysfs_notify(&rdev->kobj, NULL, "state");
1999 } 2003 }
2000 return len; 2004 return len;
2001} 2005}
@@ -3525,6 +3529,7 @@ static int do_md_run(mddev_t * mddev)
3525 return -EINVAL; 3529 return -EINVAL;
3526 } 3530 }
3527 } 3531 }
3532 sysfs_notify(&rdev->kobj, NULL, "state");
3528 } 3533 }
3529 3534
3530 md_probe(mddev->unit, NULL, NULL); 3535 md_probe(mddev->unit, NULL, NULL);
@@ -4256,6 +4261,8 @@ static int add_new_disk(mddev_t * mddev, mdu_disk_info_t *info)
4256 } 4261 }
4257 if (err) 4262 if (err)
4258 export_rdev(rdev); 4263 export_rdev(rdev);
4264 else
4265 sysfs_notify(&rdev->kobj, NULL, "state");
4259 4266
4260 md_update_sb(mddev, 1); 4267 md_update_sb(mddev, 1);
4261 if (mddev->degraded) 4268 if (mddev->degraded)
@@ -5115,6 +5122,7 @@ void md_error(mddev_t *mddev, mdk_rdev_t *rdev)
5115 mddev->pers->error_handler(mddev,rdev); 5122 mddev->pers->error_handler(mddev,rdev);
5116 if (mddev->degraded) 5123 if (mddev->degraded)
5117 set_bit(MD_RECOVERY_RECOVER, &mddev->recovery); 5124 set_bit(MD_RECOVERY_RECOVER, &mddev->recovery);
5125 set_bit(StateChanged, &rdev->flags);
5118 set_bit(MD_RECOVERY_INTR, &mddev->recovery); 5126 set_bit(MD_RECOVERY_INTR, &mddev->recovery);
5119 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); 5127 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
5120 md_wakeup_thread(mddev->thread); 5128 md_wakeup_thread(mddev->thread);
@@ -6037,6 +6045,10 @@ void md_check_recovery(mddev_t *mddev)
6037 if (mddev->flags) 6045 if (mddev->flags)
6038 md_update_sb(mddev, 0); 6046 md_update_sb(mddev, 0);
6039 6047
6048 rdev_for_each(rdev, rtmp, mddev)
6049 if (test_and_clear_bit(StateChanged, &rdev->flags))
6050 sysfs_notify(&rdev->kobj, NULL, "state");
6051
6040 6052
6041 if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) && 6053 if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) &&
6042 !test_bit(MD_RECOVERY_DONE, &mddev->recovery)) { 6054 !test_bit(MD_RECOVERY_DONE, &mddev->recovery)) {