linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
To: jes.sorensen@gmail.com
Cc: linux-raid@vger.kernel.org, Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
Subject: [PATCH] Monitor: Check redundancy for arrays
Date: Mon,  4 Sep 2017 12:52:46 +0200	[thread overview]
Message-ID: <1504522366-21913-1-git-send-email-mariusz.tkaczyk@intel.com> (raw)

GET_MISMATCH option doesn't exist for RAID arrays without redundancy
so sysfs_read fails if this information is requested. Set options
according to the device using information from /proc/mdstat.

Signed-off-by: Mariusz Tkaczyk <mariusz.tkaczyk@intel.com>
---
 Monitor.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/Monitor.c b/Monitor.c
index 497e364..b60996b 100644
--- a/Monitor.c
+++ b/Monitor.c
@@ -466,7 +466,7 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
 	int new_array = 0;
 	int retval;
 	int is_container = 0;
-	unsigned long array_only_flags = 0;
+	unsigned long redundancy_only_flags = 0;
 
 	if (test)
 		alert("TestMessage", dev, NULL, ainfo);
@@ -504,11 +504,11 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
 	if (md_get_array_info(fd, &array) < 0)
 		goto disappeared;
 
-	if (!is_container)
-		array_only_flags |= GET_MISMATCH;
+	if (!is_container && map_name(pers, mse->level) > 0)
+		redundancy_only_flags |= GET_MISMATCH;
 
 	sra = sysfs_read(-1, st->devnm, GET_LEVEL | GET_DISKS | GET_DEVS |
-			GET_STATE | array_only_flags);
+			GET_STATE | redundancy_only_flags);
 
 	if (!sra)
 		goto disappeared;
-- 
1.8.3.1


             reply	other threads:[~2017-09-04 10:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-04 10:52 Mariusz Tkaczyk [this message]
2017-10-02 19:44 ` [PATCH] Monitor: Check redundancy for arrays Jes Sorensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1504522366-21913-1-git-send-email-mariusz.tkaczyk@intel.com \
    --to=mariusz.tkaczyk@intel.com \
    --cc=jes.sorensen@gmail.com \
    --cc=linux-raid@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).