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

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