Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:FrontRunner
mdadm.14070
0098-Detail-determine-array-state-from-sysfs.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0098-Detail-determine-array-state-from-sysfs.patch of Package mdadm.14070
From a4dcdb23ea639d14e92d1c86336de7ad505b2f7d Mon Sep 17 00:00:00 2001 From: Jes Sorensen <jsorensen@fb.com> Date: Tue, 25 Apr 2017 11:40:27 -0400 Subject: [PATCH] Detail: determine array state from sysfs Git-commit: a4dcdb23ea639d14e92d1c86336de7ad505b2f7d Patch-mainline: mdadm-4.0+ References: bsc#1069165, bsc#1069167, bsc#1068030 This is easily obtained from sysfs as part of the existing call to sysfs_read() and it simplifies the code a little too. Another small step in the process of getting rid of the GET_ARRAY_STATE ioctl. Signed-off-by: Jes Sorensen <jsorensen@fb.com> Signed-off-by: Coly Li <colyli@suse.de> --- Detail.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Detail.c b/Detail.c index 91c5a98..eb69276 100644 --- a/Detail.c +++ b/Detail.c @@ -86,7 +86,7 @@ int Detail(char *dev, struct context *c) dev, strerror(errno)); return rv; } - sra = sysfs_read(fd, NULL, GET_VERSION|GET_DEVS); + sra = sysfs_read(fd, NULL, GET_VERSION | GET_DEVS | GET_ARRAY_STATE); if (!sra) { pr_err("%s does not appear to be an md device\n", dev); close(fd); @@ -94,10 +94,10 @@ int Detail(char *dev, struct context *c) } external = (sra != NULL && sra->array.major_version == -1 && sra->array.minor_version == -2); + inactive = (sra->array_state == ARRAY_ACTIVE || + sra->array_state == ARRAY_CLEAR); st = super_by_fd(fd, &subarray); - if (md_get_array_info(fd, &array) == 0) { - inactive = 0; - } else if (errno == ENODEV && sra) { + if (md_get_array_info(fd, &array) && errno == ENODEV) { if (sra->array.major_version == -1 && sra->array.minor_version == -1 && sra->devs == NULL) { @@ -107,7 +107,6 @@ int Detail(char *dev, struct context *c) return rv; } array = sra->array; - inactive = 1; } else { pr_err("cannot get array detail for %s: %s\n", dev, strerror(errno)); -- 2.13.6
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor