On 4/17/20 7:55 AM, Tkaczyk Mariusz wrote: > 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@xxxxxxxxx> > --- > v2: removed unused variable. > > Manage.c | 6 +---- > super-intel.c | 66 +++++++++++++++++++++++++++++++++------------------ > 2 files changed, 44 insertions(+), 28 deletions(-) Applied! Thanks, Jes