]> git.ipfire.org Git - thirdparty/mdadm.git/commit - super-intel.c
Manage, imsm: Write metadata before add
authorTkaczyk Mariusz <mariusz.tkaczyk@intel.com>
Fri, 17 Apr 2020 11:55:55 +0000 (13:55 +0200)
committerJes Sorensen <jsorensen@fb.com>
Mon, 27 Apr 2020 14:36:58 +0000 (10:36 -0400)
commit12724c018c964596aa277489fd287d5c3506361a
treea2a41839ae4aa4a68001f35ed986ac6473747426
parent1c294b5d960abeeb9e0f188af294d019bc82b20e
Manage, imsm: Write metadata before add

New drive in container always appears as spare. Manager is able to
handle that, and queues appropriative update to monitor.
No update from mdadm side has to be processed, just insert the drive and
ping the mdmon. Metadata has to be written if no mdmon is running (case
for Raid0 or container without arrays).

If bare drive is added very early on startup (by custom bare rule),
there is possiblity that mdmon was not restarted after switch root. Old
one is not able to handle new drive. New one fails because there is
drive without metadata in container and metadata cannot be loaded.

To prevent this, write spare metadata before adding device
to container. Mdmon will overwrite it (same case as spare migration,
if drive appears it writes the most recent metadata).
Metadata has to be written only on new drive before sysfs_add_disk(),
don't race with mdmon if running.

Signed-off-by: Tkaczyk Mariusz <mariusz.tkaczyk@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Manage.c
super-intel.c