aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-05-06 22:51:06 -0400
committerNeilBrown <neilb@suse.de>2009-05-06 22:51:06 -0400
commitc4647292fda0833bebe45be27f04453b736981fa (patch)
tree85c89a4161b06b1c591a76c2a68ff51fc02ff6f4 /drivers/md/md.c
parent5bf295975416f8e97117bbbcfb0191c00bc3e2b4 (diff)
md: remove rd%d links immediately after stopping an array.
md maintains link in sys/mdXX/md/ to identify which device has which role in the array. e.g. rd2 -> dev-sda indicates that the device with role '2' in the array is sda. These links are only present when the array is active. They are created immediately after ->run is called, and so should be removed immediately after ->stop is called. However they are currently removed a little bit later, and it is possible for ->run to be called again, thus adding these links, before they are removed. So move the removal earlier so they are consistently only present when the array is active. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index 1dd723d3188..fccc8343a25 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -4294,6 +4294,7 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open)
4294{ 4294{
4295 int err = 0; 4295 int err = 0;
4296 struct gendisk *disk = mddev->gendisk; 4296 struct gendisk *disk = mddev->gendisk;
4297 mdk_rdev_t *rdev;
4297 4298
4298 if (atomic_read(&mddev->openers) > is_open) { 4299 if (atomic_read(&mddev->openers) > is_open) {
4299 printk("md: %s still in use.\n",mdname(mddev)); 4300 printk("md: %s still in use.\n",mdname(mddev));
@@ -4336,6 +4337,13 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open)
4336 /* tell userspace to handle 'inactive' */ 4337 /* tell userspace to handle 'inactive' */
4337 sysfs_notify_dirent(mddev->sysfs_state); 4338 sysfs_notify_dirent(mddev->sysfs_state);
4338 4339
4340 list_for_each_entry(rdev, &mddev->disks, same_set)
4341 if (rdev->raid_disk >= 0) {
4342 char nm[20];
4343 sprintf(nm, "rd%d", rdev->raid_disk);
4344 sysfs_remove_link(&mddev->kobj, nm);
4345 }
4346
4339 set_capacity(disk, 0); 4347 set_capacity(disk, 0);
4340 mddev->changed = 1; 4348 mddev->changed = 1;
4341 4349
@@ -4356,7 +4364,6 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open)
4356 * Free resources if final stop 4364 * Free resources if final stop
4357 */ 4365 */
4358 if (mode == 0) { 4366 if (mode == 0) {
4359 mdk_rdev_t *rdev;
4360 4367
4361 printk(KERN_INFO "md: %s stopped.\n", mdname(mddev)); 4368 printk(KERN_INFO "md: %s stopped.\n", mdname(mddev));
4362 4369
@@ -4368,13 +4375,6 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open)
4368 } 4375 }
4369 mddev->bitmap_offset = 0; 4376 mddev->bitmap_offset = 0;
4370 4377
4371 list_for_each_entry(rdev, &mddev->disks, same_set)
4372 if (rdev->raid_disk >= 0) {
4373 char nm[20];
4374 sprintf(nm, "rd%d", rdev->raid_disk);
4375 sysfs_remove_link(&mddev->kobj, nm);
4376 }
4377
4378 /* make sure all md_delayed_delete calls have finished */ 4378 /* make sure all md_delayed_delete calls have finished */
4379 flush_scheduled_work(); 4379 flush_scheduled_work();
4380 4380