dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

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

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