From: Christoph Hellwig Date: Wed, 1 Sep 2021 11:38:32 +0000 (+0200) Subject: md: extend disks_mutex coverage X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=94f3cd7d832c28681f1dea54b4dd8606e5e2bc75;p=linux.git 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 Signed-off-by: Song Liu Signed-off-by: Jens Axboe --- diff --git a/drivers/md/md.c b/drivers/md/md.c index e04a23dc46bf1..946bbedf5dcf7 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -5725,12 +5725,12 @@ static int md_alloc(dev_t dev, char *name) error = 0; } abort: - mutex_unlock(&disks_mutex); if (!error && mddev->kobj.sd) { kobject_uevent(&mddev->kobj, KOBJ_ADD); mddev->sysfs_state = sysfs_get_dirent_safe(mddev->kobj.sd, "array_state"); mddev->sysfs_level = sysfs_get_dirent_safe(mddev->kobj.sd, "level"); } + mutex_unlock(&disks_mutex); mddev_put(mddev); return error; }