SHA256
1
0
forked from pool/mdadm
mdadm/0011-Detail-handle-non-existent-arrays-better.patch
Neil Brown 35f025d42c - New upstream release 4.0
Multiple bugfixes and various enhancements
  including IMSM support for bad blocks and 4K block devices.
  (FATE#321941)
- 0001-Generic-support-for-consistency-policy-and-PPL.patch
- 0002-Detail-show-consistency-policy.patch
- 0003-imsm-PPL-support.patch
- 0004-super1-PPL-support.patch
- 0005-Add-ppl-and-no-ppl-options-for-update.patch
- 0006-Grow-support-consistency-policy-change.patch
   Add support for Partial Parity Logs
   (FATE#321941)
- 0007-udev-md-raid-assembly.rules-Skip-non-ready-devices.patch
   (bsc#956236)
- 0008-Retry-HOT_REMOVE_DISK-a-few-times.patch
   (bsc#808647)
- 0009-Introduce-sys_hot_remove_disk.patch
   (bsc#974154)
- 0010-Add-force-flag-to-hot_remove_disk.patch
   (bsc#808647)
- 0011-Detail-handle-non-existent-arrays-better.patch
   (bsc#966773)

OBS-URL: https://build.opensuse.org/package/show/Base:System/mdadm?expand=0&rev=147
2017-03-27 03:26:19 +00:00

44 lines
1.2 KiB
Diff

From f58545b578e839df2f1682fd68f36079d4c39134 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.com>
Date: Mon, 27 Mar 2017 14:21:11 +1100
Subject: [PATCH] Detail: handle non-existent arrays better.
If you call "mdadm --detail" with a device file for an array which
doesn't exist, such as by
mknod /dev/md57 b 9 57
mdadm --detail /dev/md57
you get an unhelpful message about and inactive RAID0, and return
status is '0'. This is confusing.
So catch this possibility and print a more useful message, and
return a non-zero status.
Signed-off-by: NeilBrown <neilb@suse.com>
---
Detail.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Detail.c b/Detail.c
index 509b0d418768..d9d1b7092167 100644
--- a/Detail.c
+++ b/Detail.c
@@ -110,6 +110,14 @@ int Detail(char *dev, struct context *c)
if (ioctl(fd, GET_ARRAY_INFO, &array) == 0) {
inactive = 0;
} else if (errno == ENODEV && sra) {
+ if (sra->array.major_version == -1 &&
+ sra->array.minor_version == -1 &&
+ sra->devs == NULL) {
+ pr_err("Array associated with md device %s does not exist.\n", dev);
+ close(fd);
+ sysfs_free(sra);
+ return rv;
+ }
array = sra->array;
inactive = 1;
} else {
--
2.12.0