forked from luck/tmp_suning_uos_patched
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);
|
||||
|
||||
if (mddev->private == &md_redundancy_group) {
|
||||
if (mddev->private) {
|
||||
sysfs_remove_group(&mddev->kobj, &md_redundancy_group);
|
||||
if (mddev->private != (void*)1)
|
||||
sysfs_remove_group(&mddev->kobj, mddev->private);
|
||||
if (mddev->sysfs_action)
|
||||
sysfs_put(mddev->sysfs_action);
|
||||
mddev->sysfs_action = NULL;
|
||||
|
@ -4287,10 +4289,7 @@ static int do_md_run(mddev_t * mddev)
|
|||
sysfs_notify_dirent(rdev->sysfs_state);
|
||||
}
|
||||
|
||||
md_probe(mddev->unit, NULL, NULL);
|
||||
disk = mddev->gendisk;
|
||||
if (!disk)
|
||||
return -ENOMEM;
|
||||
|
||||
spin_lock(&pers_lock);
|
||||
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->backing_dev_info.congested_fn = NULL;
|
||||
module_put(mddev->pers->owner);
|
||||
if (mddev->pers->sync_request)
|
||||
mddev->private = &md_redundancy_group;
|
||||
if (mddev->pers->sync_request && mddev->private == NULL)
|
||||
mddev->private = (void*)1;
|
||||
mddev->pers = NULL;
|
||||
/* tell userspace to handle 'inactive' */
|
||||
sysfs_notify_dirent(mddev->sysfs_state);
|
||||
|
@ -4578,9 +4577,6 @@ static int do_md_stop(mddev_t * mddev, int mode, int is_open)
|
|||
}
|
||||
mddev->bitmap_info.offset = 0;
|
||||
|
||||
/* make sure all md_delayed_delete calls have finished */
|
||||
flush_scheduled_work();
|
||||
|
||||
export_array(mddev);
|
||||
|
||||
mddev->array_sectors = 0;
|
||||
|
|
|
@ -5136,9 +5136,8 @@ static int stop(mddev_t *mddev)
|
|||
mddev->thread = NULL;
|
||||
mddev->queue->backing_dev_info.congested_fn = NULL;
|
||||
blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/
|
||||
sysfs_remove_group(&mddev->kobj, &raid5_attrs_group);
|
||||
free_conf(conf);
|
||||
mddev->private = NULL;
|
||||
mddev->private = &raid5_attrs_group;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -5464,11 +5463,11 @@ static int raid5_start_reshape(mddev_t *mddev)
|
|||
!test_bit(Faulty, &rdev->flags)) {
|
||||
if (raid5_add_disk(mddev, rdev) == 0) {
|
||||
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);
|
||||
else
|
||||
added_devices++;
|
||||
} else
|
||||
rdev->recovery_offset = 0;
|
||||
added_devices++;
|
||||
sprintf(nm, "rd%d", rdev->raid_disk);
|
||||
if (sysfs_create_link(&mddev->kobj,
|
||||
&rdev->kobj, nm))
|
||||
|
@ -5480,9 +5479,12 @@ static int raid5_start_reshape(mddev_t *mddev)
|
|||
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) {
|
||||
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;
|
||||
spin_unlock_irqrestore(&conf->device_lock, flags);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user