Commit 94f3cd7d authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Jens Axboe
Browse files

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: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarSong Liu <songliubraving@fb.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 51238e7f
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;
}