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.
This commit is contained in:
commit
ac73fddfc5
|
@ -4075,8 +4075,10 @@ static void mddev_delayed_delete(struct work_struct *ws)
|
||||||
{
|
{
|
||||||
mddev_t *mddev = container_of(ws, mddev_t, del_work);
|
mddev_t *mddev = container_of(ws, mddev_t, del_work);
|
||||||
|
|
||||||
if (mddev->private == &md_redundancy_group) {
|
if (mddev->private) {
|
||||||
sysfs_remove_group(&mddev->kobj, &md_redundancy_group);
|
sysfs_remove_group(&mddev->kobj, &md_redundancy_group);
|
||||||
|
if (mddev->private != (void*)1)
|
||||||
|
sysfs_remove_group(&mddev->kobj, mddev->private);
|
||||||
if (mddev->sysfs_action)
|
if (mddev->sysfs_action)
|
||||||
sysfs_put(mddev->sysfs_action);
|
sysfs_put(mddev->sysfs_action);
|
||||||
mddev->sysfs_action = NULL;
|
mddev->sysfs_action = NULL;
|
||||||
|
@ -4287,10 +4289,7 @@ static int do_md_run(mddev_t * mddev)
|
||||||
sysfs_notify_dirent(rdev->sysfs_state);
|
sysfs_notify_dirent(rdev->sysfs_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
md_probe(mddev->unit, NULL, NULL);
|
|
||||||
disk = mddev->gendisk;
|
disk = mddev->gendisk;
|
||||||
if (!disk)
|
|
||||||
return -ENOMEM;
|
|
||||||
|
|
||||||
spin_lock(&pers_lock);
|
spin_lock(&pers_lock);
|
||||||
pers = find_pers(mddev->level, mddev->clevel);
|
pers = find_pers(mddev->level, mddev->clevel);
|
||||||
|
@ -4530,8 +4529,8 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open)
|
||||||
mddev->queue->unplug_fn = NULL;
|
mddev->queue->unplug_fn = NULL;
|
||||||
mddev->queue->backing_dev_info.congested_fn = NULL;
|
mddev->queue->backing_dev_info.congested_fn = NULL;
|
||||||
module_put(mddev->pers->owner);
|
module_put(mddev->pers->owner);
|
||||||
if (mddev->pers->sync_request)
|
if (mddev->pers->sync_request && mddev->private == NULL)
|
||||||
mddev->private = &md_redundancy_group;
|
mddev->private = (void*)1;
|
||||||
mddev->pers = NULL;
|
mddev->pers = NULL;
|
||||||
/* tell userspace to handle 'inactive' */
|
/* tell userspace to handle 'inactive' */
|
||||||
sysfs_notify_dirent(mddev->sysfs_state);
|
sysfs_notify_dirent(mddev->sysfs_state);
|
||||||
|
@ -4578,9 +4577,6 @@ out:
|
||||||
}
|
}
|
||||||
mddev->bitmap_info.offset = 0;
|
mddev->bitmap_info.offset = 0;
|
||||||
|
|
||||||
/* make sure all md_delayed_delete calls have finished */
|
|
||||||
flush_scheduled_work();
|
|
||||||
|
|
||||||
export_array(mddev);
|
export_array(mddev);
|
||||||
|
|
||||||
mddev->array_sectors = 0;
|
mddev->array_sectors = 0;
|
||||||
|
|
|
@ -5136,9 +5136,8 @@ static int stop(mddev_t *mddev)
|
||||||
mddev->thread = NULL;
|
mddev->thread = NULL;
|
||||||
mddev->queue->backing_dev_info.congested_fn = NULL;
|
mddev->queue->backing_dev_info.congested_fn = NULL;
|
||||||
blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/
|
blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/
|
||||||
sysfs_remove_group(&mddev->kobj, &raid5_attrs_group);
|
|
||||||
free_conf(conf);
|
free_conf(conf);
|
||||||
mddev->private = NULL;
|
mddev->private = &raid5_attrs_group;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5464,11 +5463,11 @@ static int raid5_start_reshape(mddev_t *mddev)
|
||||||
!test_bit(Faulty, &rdev->flags)) {
|
!test_bit(Faulty, &rdev->flags)) {
|
||||||
if (raid5_add_disk(mddev, rdev) == 0) {
|
if (raid5_add_disk(mddev, rdev) == 0) {
|
||||||
char nm[20];
|
char nm[20];
|
||||||
if (rdev->raid_disk >= conf->previous_raid_disks)
|
if (rdev->raid_disk >= conf->previous_raid_disks) {
|
||||||
set_bit(In_sync, &rdev->flags);
|
set_bit(In_sync, &rdev->flags);
|
||||||
else
|
added_devices++;
|
||||||
|
} else
|
||||||
rdev->recovery_offset = 0;
|
rdev->recovery_offset = 0;
|
||||||
added_devices++;
|
|
||||||
sprintf(nm, "rd%d", rdev->raid_disk);
|
sprintf(nm, "rd%d", rdev->raid_disk);
|
||||||
if (sysfs_create_link(&mddev->kobj,
|
if (sysfs_create_link(&mddev->kobj,
|
||||||
&rdev->kobj, nm))
|
&rdev->kobj, nm))
|
||||||
|
@ -5480,9 +5479,12 @@ static int raid5_start_reshape(mddev_t *mddev)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* When a reshape changes the number of devices, ->degraded
|
||||||
|
* is measured against the large of the pre and post number of
|
||||||
|
* devices.*/
|
||||||
if (mddev->delta_disks > 0) {
|
if (mddev->delta_disks > 0) {
|
||||||
spin_lock_irqsave(&conf->device_lock, flags);
|
spin_lock_irqsave(&conf->device_lock, flags);
|
||||||
mddev->degraded = (conf->raid_disks - conf->previous_raid_disks)
|
mddev->degraded += (conf->raid_disks - conf->previous_raid_disks)
|
||||||
- added_devices;
|
- added_devices;
|
||||||
spin_unlock_irqrestore(&conf->device_lock, flags);
|
spin_unlock_irqrestore(&conf->device_lock, flags);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue