diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-02-09 20:01:26 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-02-09 20:01:26 -0500 |
commit | ac73fddfc523bf3c3525d16356b44527c44fae6d (patch) | |
tree | 77c22e04557e35168b1df43e1018a4f8241df224 | |
parent | 3af9cf11b6efb82aa7a1a24e2382b75d43631c4e (diff) | |
parent | ef286f6fa673cd7fb367e1b145069d8dbfcc6081 (diff) |
Merge branch 'for-linus' of git://neil.brown.name/md
* 'for-linus' of git://neil.brown.name/md:
md: fix some lockdep issues between md and sysfs.
md: fix 'degraded' calculation when starting a reshape.
-rw-r--r-- | drivers/md/md.c | 14 | ||||
-rw-r--r-- | drivers/md/raid5.c | 14 |
2 files changed, 13 insertions, 15 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index dd3dfe42d5a9..a20a71e5efd3 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -4075,8 +4075,10 @@ static void mddev_delayed_delete(struct work_struct *ws) | |||
4075 | { | 4075 | { |
4076 | mddev_t *mddev = container_of(ws, mddev_t, del_work); | 4076 | mddev_t *mddev = container_of(ws, mddev_t, del_work); |
4077 | 4077 | ||
4078 | if (mddev->private == &md_redundancy_group) { | 4078 | if (mddev->private) { |
4079 | sysfs_remove_group(&mddev->kobj, &md_redundancy_group); | 4079 | sysfs_remove_group(&mddev->kobj, &md_redundancy_group); |
4080 | if (mddev->private != (void*)1) | ||
4081 | sysfs_remove_group(&mddev->kobj, mddev->private); | ||
4080 | if (mddev->sysfs_action) | 4082 | if (mddev->sysfs_action) |
4081 | sysfs_put(mddev->sysfs_action); | 4083 | sysfs_put(mddev->sysfs_action); |
4082 | mddev->sysfs_action = NULL; | 4084 | mddev->sysfs_action = NULL; |
@@ -4287,10 +4289,7 @@ static int do_md_run(mddev_t * mddev) | |||
4287 | sysfs_notify_dirent(rdev->sysfs_state); | 4289 | sysfs_notify_dirent(rdev->sysfs_state); |
4288 | } | 4290 | } |
4289 | 4291 | ||
4290 | md_probe(mddev->unit, NULL, NULL); | ||
4291 | disk = mddev->gendisk; | 4292 | disk = mddev->gendisk; |
4292 | if (!disk) | ||
4293 | return -ENOMEM; | ||
4294 | 4293 | ||
4295 | spin_lock(&pers_lock); | 4294 | spin_lock(&pers_lock); |
4296 | pers = find_pers(mddev->level, mddev->clevel); | 4295 | pers = find_pers(mddev->level, mddev->clevel); |
@@ -4530,8 +4529,8 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open) | |||
4530 | mddev->queue->unplug_fn = NULL; | 4529 | mddev->queue->unplug_fn = NULL; |
4531 | mddev->queue->backing_dev_info.congested_fn = NULL; | 4530 | mddev->queue->backing_dev_info.congested_fn = NULL; |
4532 | module_put(mddev->pers->owner); | 4531 | module_put(mddev->pers->owner); |
4533 | if (mddev->pers->sync_request) | 4532 | if (mddev->pers->sync_request && mddev->private == NULL) |
4534 | mddev->private = &md_redundancy_group; | 4533 | mddev->private = (void*)1; |
4535 | mddev->pers = NULL; | 4534 | mddev->pers = NULL; |
4536 | /* tell userspace to handle 'inactive' */ | 4535 | /* tell userspace to handle 'inactive' */ |
4537 | sysfs_notify_dirent(mddev->sysfs_state); | 4536 | sysfs_notify_dirent(mddev->sysfs_state); |
@@ -4578,9 +4577,6 @@ out: | |||
4578 | } | 4577 | } |
4579 | mddev->bitmap_info.offset = 0; | 4578 | mddev->bitmap_info.offset = 0; |
4580 | 4579 | ||
4581 | /* make sure all md_delayed_delete calls have finished */ | ||
4582 | flush_scheduled_work(); | ||
4583 | |||
4584 | export_array(mddev); | 4580 | export_array(mddev); |
4585 | 4581 | ||
4586 | mddev->array_sectors = 0; | 4582 | mddev->array_sectors = 0; |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index e84204eb12df..ceb24afdc147 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -5136,9 +5136,8 @@ static int stop(mddev_t *mddev) | |||
5136 | mddev->thread = NULL; | 5136 | mddev->thread = NULL; |
5137 | mddev->queue->backing_dev_info.congested_fn = NULL; | 5137 | mddev->queue->backing_dev_info.congested_fn = NULL; |
5138 | blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/ | 5138 | blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/ |
5139 | sysfs_remove_group(&mddev->kobj, &raid5_attrs_group); | ||
5140 | free_conf(conf); | 5139 | free_conf(conf); |
5141 | mddev->private = NULL; | 5140 | mddev->private = &raid5_attrs_group; |
5142 | return 0; | 5141 | return 0; |
5143 | } | 5142 | } |
5144 | 5143 | ||
@@ -5464,11 +5463,11 @@ static int raid5_start_reshape(mddev_t *mddev) | |||
5464 | !test_bit(Faulty, &rdev->flags)) { | 5463 | !test_bit(Faulty, &rdev->flags)) { |
5465 | if (raid5_add_disk(mddev, rdev) == 0) { | 5464 | if (raid5_add_disk(mddev, rdev) == 0) { |
5466 | char nm[20]; | 5465 | char nm[20]; |
5467 | if (rdev->raid_disk >= conf->previous_raid_disks) | 5466 | if (rdev->raid_disk >= conf->previous_raid_disks) { |
5468 | set_bit(In_sync, &rdev->flags); | 5467 | set_bit(In_sync, &rdev->flags); |
5469 | else | 5468 | added_devices++; |
5469 | } else | ||
5470 | rdev->recovery_offset = 0; | 5470 | rdev->recovery_offset = 0; |
5471 | added_devices++; | ||
5472 | sprintf(nm, "rd%d", rdev->raid_disk); | 5471 | sprintf(nm, "rd%d", rdev->raid_disk); |
5473 | if (sysfs_create_link(&mddev->kobj, | 5472 | if (sysfs_create_link(&mddev->kobj, |
5474 | &rdev->kobj, nm)) | 5473 | &rdev->kobj, nm)) |
@@ -5480,9 +5479,12 @@ static int raid5_start_reshape(mddev_t *mddev) | |||
5480 | break; | 5479 | break; |
5481 | } | 5480 | } |
5482 | 5481 | ||
5482 | /* When a reshape changes the number of devices, ->degraded | ||
5483 | * is measured against the large of the pre and post number of | ||
5484 | * devices.*/ | ||
5483 | if (mddev->delta_disks > 0) { | 5485 | if (mddev->delta_disks > 0) { |
5484 | spin_lock_irqsave(&conf->device_lock, flags); | 5486 | spin_lock_irqsave(&conf->device_lock, flags); |
5485 | mddev->degraded = (conf->raid_disks - conf->previous_raid_disks) | 5487 | mddev->degraded += (conf->raid_disks - conf->previous_raid_disks) |
5486 | - added_devices; | 5488 | - added_devices; |
5487 | spin_unlock_irqrestore(&conf->device_lock, flags); | 5489 | spin_unlock_irqrestore(&conf->device_lock, flags); |
5488 | } | 5490 | } |