Skip to contentSkip to conversation

Block overwriting existing links while manual assembly

PATCH Superseded Kinga Tanska 2 participants 2 messages May 27, 2020 MD RAID

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Block overwriting existing links while manual assembly

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

Change-Id I29ef58636e8fd8583bcaef1b28b6cf2edec385ef
---
 Assemble.c | 4 ++++
 1 file changed, 4 insertions(+)
Assemble.c +4 -0
index 6b5a7c8e..92616251 100644
@@ -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
Signature · 1 line
2.16.4
#1 lore raw
Quoted 8 lines · Kinga Tanska

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

Change-Id I29ef58636e8fd8583bcaef1b28b6cf2edec385ef
---
 Assemble.c | 4 ++++
 1 file changed, 4 insertions(+)

Looks fine to me, but what is that non-standard Change-Id: tag you added?

Thanks,
Jes

Quoted 16 lines
Assemble.c +4 -0
index 6b5a7c8e..92616251 100644
@@ -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