Block overwriting existing links while manual assembly

Manual assembly with existing link caused overwriting
this link. Add checking link and block this situation.

Signed-off-by: Kinga Tanska <kinga.tanska@intel.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
This commit is contained in:
Kinga Tanska 2020-05-29 08:31:36 +02:00 committed by Jes Sorensen
parent d92cee7b37
commit 7758ada9f3
1 changed files with 4 additions and 0 deletions

View File

@ -1482,6 +1482,10 @@ try_again:
name = content->name;
break;
}
if (mddev && map_by_name(&map, mddev) != NULL) {
pr_err("Cannot create device with %s because is in use\n", mddev);
goto out;
}
if (!auto_assem)
/* If the array is listed in mdadm.conf or on
* command line, then we trust the name