dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/0074-Assemble-print-error-message-if-mdadm-fails-assembli.patch

2792dd
From 5cfb79dea26d9d7266f79c7c196a1a9f70c16a28 Mon Sep 17 00:00:00 2001
2792dd
From: Gioh Kim <gi-oh.kim@cloud.ionos.com>
2792dd
Date: Tue, 16 Apr 2019 18:08:17 +0200
2792dd
Subject: [RHEL7.9 PATCH 74/77] Assemble: print error message if mdadm fails
2792dd
 assembling with --uuid option
2792dd
2792dd
When mdadm tries to assemble one working device and one zeroed-out device,
2792dd
it failed but print successful message because there is --uuid option.
2792dd
2792dd
Following script always reproduce it.
2792dd
2792dd
dd if=/dev/zero of=/dev/ram0 oflag=direct
2792dd
dd if=/dev/zero of=/dev/ram1 oflag=direct
2792dd
./mdadm -C /dev/md111 -e 1.2 --uuid="12345678:12345678:12345678:12345678" \
2792dd
    -l1 -n2 /dev/ram0 /dev/ram1
2792dd
./mdadm -S /dev/md111
2792dd
dd if=/dev/zero of=/dev/ram1 oflag=direct
2792dd
./mdadm -A /dev/md111 --uuid="12345678:12345678:12345678:12345678" \
2792dd
    /dev/ram0 /dev/ram1
2792dd
2792dd
Following is message from mdadm.
2792dd
2792dd
mdadm: No super block found on /dev/ram1 (Expected magic a92b4efc, got 00000000)
2792dd
mdadm: no RAID superblock on /dev/ram1
2792dd
mdadm: /dev/md111 assembled from 1 drive - need all 2 to start it (use --run to insist).
2792dd
2792dd
The mdadm say that it assembled but mdadm does not create /dev/md111.
2792dd
The message is wrong.
2792dd
2792dd
After applying this patch, mdadm reports error correctly as following.
2792dd
2792dd
mdadm: No super block found on /dev/ram1 (Expected magic a92b4efc, got 00000000)
2792dd
mdadm: no RAID superblock on /dev/ram1
2792dd
mdadm: /dev/ram1 has no superblock - assembly aborted
2792dd
2792dd
Signed-off-by: Gioh Kim <gi-oh.kim@cloud.ionos.com>
2792dd
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2792dd
---
2792dd
 Assemble.c | 2 +-
2792dd
 1 file changed, 1 insertion(+), 1 deletion(-)
2792dd
2792dd
diff --git a/Assemble.c b/Assemble.c
2792dd
index 6b5a7c8..2ed5884 100644
2792dd
--- a/Assemble.c
2792dd
+++ b/Assemble.c
2792dd
@@ -269,7 +269,7 @@ static int select_devices(struct mddev_dev *devlist,
2792dd
 			if (auto_assem || !inargv)
2792dd
 				/* Ignore unrecognised devices during auto-assembly */
2792dd
 				goto loop;
2792dd
-			if (ident->uuid_set || ident->name[0] ||
2792dd
+			if (ident->name[0] ||
2792dd
 			    ident->super_minor != UnSet)
2792dd
 				/* Ignore unrecognised device if looking for
2792dd
 				 * specific array */
2792dd
-- 
2792dd
2.7.5
2792dd