linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 09/17] Monitor: avoid skipping checks on external arays
@ 2010-10-29 14:23 Czarnowska, Anna
  2010-11-05  5:47 ` Dan Williams
  0 siblings, 1 reply; 4+ messages in thread
From: Czarnowska, Anna @ 2010-10-29 14:23 UTC (permalink / raw)
  To: Neil Brown
  Cc: linux-raid@vger.kernel.org, Neubauer, Wojciech, Williams, Dan J,
	Ciechanowski, Ed, Labun, Marcin,
	Hawrylewicz Czarnowski, Przemyslaw, Czarnowska, Anna

From bb9ca6dbe0a92e00b21cd8985533b561b40ed6b9 Mon Sep 17 00:00:00 2001
From: Anna Czarnowska <anna.czarnowska@intel.com>
Date: Mon, 25 Oct 2010 11:30:43 +0200
Subject: [PATCH 09/17] Monitor: avoid skipping checks on external arays

utime is not correct for external metadata so we can only
skip further checks for native metadata

Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com>
---
 Monitor.c |   33 ++++++++++++++++++++++++++-------
 1 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/Monitor.c b/Monitor.c
index a4bfedd..d915d7d 100644
--- a/Monitor.c
+++ b/Monitor.c
@@ -50,6 +50,7 @@ struct state {
 	int devstate[MaxDisks];
 	unsigned devid[MaxDisks];
 	int percent;
+	char *metadata_version;
 	struct state *next;
 };
 
@@ -223,6 +224,7 @@ int Monitor(mddev_dev_t devlist,
 				st->spare_group = strdup(mdlist->spare_group);
 			else
 				st->spare_group = NULL;
+			st->metadata_version = NULL;
 			statelist = st;
 		}
 	} else {
@@ -240,6 +242,7 @@ int Monitor(mddev_dev_t devlist,
 			st->percent = -2;
 			st->expected_spares = -1;
 			st->spare_group = NULL;
+			st->metadata_version = NULL;
 			if (mdlist) {
 				st->expected_spares = mdlist->spare_disks;
 				if (mdlist->spare_group)
@@ -328,17 +331,22 @@ int Monitor(mddev_dev_t devlist,
 				/* external arrays don't update utime */
 				array.utime = time(0);
 
-			if (st->utime == array.utime &&
-			    st->failed == array.failed_disks &&
-			    st->working == array.working_disks &&
-			    st->spare == array.spare_disks &&
-			    (mse == NULL  || (
-				    mse->percent == st->percent
-				    ))) {
+			/* utime cannot  be trusted for external
+			 * metadata, so treat utime for external
+			 * metadata as different
+			 */
+			if  (st->utime == array.utime &&
+			     st->metadata_version &&
+			     !is_external(st->metadata_version) &&
+			     st->failed == array.failed_disks &&
+			     st->working == array.working_disks &&
+			     st->spare == array.spare_disks &&
+			     mse->percent == st->percent) {
 				close(fd);
 				st->err = 0;
 				continue;
 			}
+
 			if (st->utime == 0 && /* new array */
 			    mse->pattern && strchr(mse->pattern, '_') /* degraded */
 				)
@@ -454,6 +462,16 @@ int Monitor(mddev_dev_t devlist,
 			st->utime = array.utime;
 			st->raid = array.raid_disks;
 			st->err = 0;
+			if (mse->metadata_version) {
+				if (!st->metadata_version)
+					st->metadata_version = strdup(mse->metadata_version);
+				else if (strcmp(st->metadata_version,
+						mse->metadata_version) != 0) {
+					free(st->metadata_version);
+					st->metadata_version = strdup(mse->metadata_version);
+				}
+			}
+
 		}
 		/* now check if there are any new devices found in mdstat */
 		if (scan) {
@@ -486,6 +504,7 @@ int Monitor(mddev_dev_t devlist,
 					st->devnum = mse->devnum;
 					st->percent = -2;
 					st->spare_group = NULL;
+					st->metadata_version = NULL;
 					st->expected_spares = -1;
 					statelist = st;
 					if (test)
-- 
1.6.4.2

---------------------------------------------------------------------
Intel Technology Poland sp. z o.o.
z siedziba w Gdansku
ul. Slowackiego 173
80-298 Gdansk

Sad Rejonowy Gdansk Polnoc w Gdansku, 
VII Wydzial Gospodarczy Krajowego Rejestru Sadowego, 
numer KRS 101882

NIP 957-07-52-316
Kapital zakladowy 200.000 zl

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-11-05 16:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-29 14:23 [PATCH 09/17] Monitor: avoid skipping checks on external arays Czarnowska, Anna
2010-11-05  5:47 ` Dan Williams
2010-11-05 14:56   ` Czarnowska, Anna
2010-11-05 16:17     ` Dan Williams

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).