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