[PATCH] Monitor: few bug fixes for spare migration

[PATCH] Monitor: few bug fixes for spare migration

am 25.11.2010 18:28:29 von anna.czarnowska

From bbe35756559c6bee0309ce7ebae668c53d5e1a74 Mon Sep 17 00:00:00 2001
From: Anna Czarnowska
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 , Ciechanowski, Ed

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

--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: [PATCH] Monitor: few bug fixes for spare migration

am 28.11.2010 23:54:10 von NeilBrown

On Thu, 25 Nov 2010 17:28:29 +0000 "Czarnowska, Anna"
wrote:

> >From bbe35756559c6bee0309ce7ebae668c53d5e1a74 Mon Sep 17 00:00:00 2001
> From: Anna Czarnowska
> 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 , Ciechanowski, Ed
>
> 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


--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html