md: extend disks_mutex coverage
disks_mutex is intended to serialize md_alloc. Extended it to also cover the kobject_uevent call and getting the sysfs dirent to help reducing error handling complexity. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
committed by
Jens Axboe
parent
51238e7fbd
commit
94f3cd7d83
@@ -5725,12 +5725,12 @@ static int md_alloc(dev_t dev, char *name)
|
|||||||
error = 0;
|
error = 0;
|
||||||
}
|
}
|
||||||
abort:
|
abort:
|
||||||
mutex_unlock(&disks_mutex);
|
|
||||||
if (!error && mddev->kobj.sd) {
|
if (!error && mddev->kobj.sd) {
|
||||||
kobject_uevent(&mddev->kobj, KOBJ_ADD);
|
kobject_uevent(&mddev->kobj, KOBJ_ADD);
|
||||||
mddev->sysfs_state = sysfs_get_dirent_safe(mddev->kobj.sd, "array_state");
|
mddev->sysfs_state = sysfs_get_dirent_safe(mddev->kobj.sd, "array_state");
|
||||||
mddev->sysfs_level = sysfs_get_dirent_safe(mddev->kobj.sd, "level");
|
mddev->sysfs_level = sysfs_get_dirent_safe(mddev->kobj.sd, "level");
|
||||||
}
|
}
|
||||||
|
mutex_unlock(&disks_mutex);
|
||||||
mddev_put(mddev);
|
mddev_put(mddev);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user