]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
md: ensure metadata is writen after raid level change.
authorNeilBrown <neilb@suse.de>
Tue, 14 Jan 2014 04:17:03 +0000 (15:17 +1100)
committerNeilBrown <neilb@suse.de>
Tue, 14 Jan 2014 05:44:21 +0000 (16:44 +1100)
level_store() currently does not make sure the metadata is
updates to reflect the new raid level.  It simply sets MD_CHANGE_DEVS.

Any level with a ->thread will quickly notice this and update the
metadata.  However RAID0 and Linear do not have a thread so no
metadata update happens until the array is stopped.  At that point the
metadata is written.

This is later that we would like.  While the delay doesn't risk any
data it can cause confusion.  So if there is no md thread, immediately
update the metadata after a level change.

Reported-by: Richard Michael <rmichael@edgeofthenet.org>
Signed-off-by: NeilBrown <neilb@suse.de>
drivers/md/md.c

index 757e388308a8695da98a37d44127f1adb7f2159b..a20b7806de7a44e622b307c94d9327707c1cb1b9 100644 (file)
@@ -3611,6 +3611,8 @@ level_store(struct mddev *mddev, const char *buf, size_t len)
        pers->run(mddev);
        set_bit(MD_CHANGE_DEVS, &mddev->flags);
        mddev_resume(mddev);
+       if (!mddev->thread)
+               md_update_sb(mddev, 1);
        sysfs_notify(&mddev->kobj, NULL, "level");
        md_new_event(mddev);
        return rv;