From 5d11bd766ee17d3b9a7d96e184704723c11a99d1 Mon Sep 17 00:00:00 2001 From: Kinga Tanska Date: Fri, 29 May 2020 08:31:36 +0200 Subject: [PATCH 24/27] 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 Signed-off-by: Jes Sorensen --- Assemble.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Assemble.c b/Assemble.c index f302deb..914c193 100644 --- a/Assemble.c +++ b/Assemble.c @@ -1467,6 +1467,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 -- 2.21.1 (Apple Git-122.3)