linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Monitor: few bug fixes for spare migration
@ 2010-11-25 17:28 Czarnowska, Anna
  2010-11-28 22:54 ` Neil Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Czarnowska, Anna @ 2010-11-25 17:28 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 bbe35756559c6bee0309ce7ebae668c53d5e1a74 Mon Sep 17 00:00:00 2001
From: Anna Czarnowska <anna.czarnowska@intel.com>
Date: Thu, 25 Nov 2010 18:25:03 +0100
Subject: [PATCH] Monitor: few bug fixes for spare migration
Cc: linux-raid@vger.kernel.org, Williams, Dan J <dan.j.williams@intel.com>, Ciechanowski, Ed <ed.ciechanowski@intel.com>

1. If array not changed we should still report anydegraded
- another array may have got a new spare that we can move.
2. Array with err=1 can't give a spare.
3. Spares can't be migrated between different metadata arrays.
4. We look for spares in "from" not "st" which is supertype
and has devname=NULL.

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

diff --git a/Monitor.c b/Monitor.c
index 9ba49f2..f1d0c9d 100644
--- a/Monitor.c
+++ b/Monitor.c
@@ -497,7 +497,10 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
 		    ))) {
 		close(fd);
 		st->err = 0;
-		return 0;
+		if ((st->active < st->raid) && st->spare == 0)
+			return 1;
+		else
+			return 0;
 	}
 	if (st->utime == 0 && /* new array */
 	    mse->pattern && strchr(mse->pattern, '_') /* degraded */
@@ -751,6 +754,10 @@ static int check_donor(struct state *from, struct state *to,
 	if (from->parent)
 		/* Cannot move from a member */
 		return 0;
+	if (from->err)
+		return 0;
+	if (from->metadata->ss != to->metadata->ss)
+		return 0;
 	for (sub = from->subarray; sub; sub = sub->subarray)
 		/* If source array has degraded subarrays, don't
 		 * remove anything
@@ -806,7 +813,7 @@ static int container_choose_spare(struct state *from, struct state *to,
 	 */
 
 	struct supertype *st = from->metadata;
-	int fd = open(st->devname, O_RDONLY);
+	int fd = open(from->devname, O_RDONLY);
 	int err;
 	struct mdinfo *disks, *d;
 	unsigned long long min_size
-- 
1.7.1


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

* Re: [PATCH] Monitor: few bug fixes for spare migration
  2010-11-25 17:28 [PATCH] Monitor: few bug fixes for spare migration Czarnowska, Anna
@ 2010-11-28 22:54 ` Neil Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Neil Brown @ 2010-11-28 22:54 UTC (permalink / raw)
  To: Czarnowska, Anna
  Cc: linux-raid@vger.kernel.org, Neubauer, Wojciech, Williams, Dan J,
	Ciechanowski, Ed, Labun, Marcin,
	Hawrylewicz Czarnowski, Przemyslaw

On Thu, 25 Nov 2010 17:28:29 +0000 "Czarnowska, Anna"
<anna.czarnowska@intel.com> wrote:

> >From bbe35756559c6bee0309ce7ebae668c53d5e1a74 Mon Sep 17 00:00:00 2001
> From: Anna Czarnowska <anna.czarnowska@intel.com>
> Date: Thu, 25 Nov 2010 18:25:03 +0100
> Subject: [PATCH] Monitor: few bug fixes for spare migration
> Cc: linux-raid@vger.kernel.org, Williams, Dan J <dan.j.williams@intel.com>, Ciechanowski, Ed <ed.ciechanowski@intel.com>
> 
> 1. If array not changed we should still report anydegraded
> - another array may have got a new spare that we can move.
> 2. Array with err=1 can't give a spare.
> 3. Spares can't be migrated between different metadata arrays.

I meant the mention this before - thanks for the reminder.

Why do you want to forbid spare migration between different metadata arrays??

If an admin wanted to impose this restriction they could easily use domains -
a different domain for each metadata type.
But if there a good reason to insist on this in the code in a way that the
sysadmin cannot over-ride it?


> 4. We look for spares in "from" not "st" which is supertype
> and has devname=NULL.

Thanks!  The other 3 changes are all good.  I have applied the patch with the
metadata type check removed for now.

NeilBrown



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

end of thread, other threads:[~2010-11-28 22:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-25 17:28 [PATCH] Monitor: few bug fixes for spare migration Czarnowska, Anna
2010-11-28 22:54 ` Neil Brown

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