Monitor: few bug fixes for spare migration
1. If array not changed we should still report any degraded - another array may have a new spare that we can move. 2. Array with err=1 can't give a spare. 3. We look for spares in "from" not "st" which is supertype and has devname=NULL. Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
976915080e
commit
ff044d6ba7
11
Monitor.c
11
Monitor.c
|
@ -424,6 +424,10 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
|
||||||
int test, struct alert_info *ainfo,
|
int test, struct alert_info *ainfo,
|
||||||
int increments)
|
int increments)
|
||||||
{
|
{
|
||||||
|
/* Update the state 'st' to reflect any changes shown in mdstat,
|
||||||
|
* or found by directly examining the array, and return
|
||||||
|
* '1' if the array is degraded, or '0' if it is optimal (or dead).
|
||||||
|
*/
|
||||||
struct { int state, major, minor; } info[MaxDisks];
|
struct { int state, major, minor; } info[MaxDisks];
|
||||||
mdu_array_info_t array;
|
mdu_array_info_t array;
|
||||||
struct mdstat_ent *mse = NULL, *mse2;
|
struct mdstat_ent *mse = NULL, *mse2;
|
||||||
|
@ -497,6 +501,9 @@ static int check_array(struct state *st, struct mdstat_ent *mdstat,
|
||||||
))) {
|
))) {
|
||||||
close(fd);
|
close(fd);
|
||||||
st->err = 0;
|
st->err = 0;
|
||||||
|
if ((st->active < st->raid) && st->spare == 0)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (st->utime == 0 && /* new array */
|
if (st->utime == 0 && /* new array */
|
||||||
|
@ -751,6 +758,8 @@ static int check_donor(struct state *from, struct state *to,
|
||||||
if (from->parent)
|
if (from->parent)
|
||||||
/* Cannot move from a member */
|
/* Cannot move from a member */
|
||||||
return 0;
|
return 0;
|
||||||
|
if (from->err)
|
||||||
|
return 0;
|
||||||
for (sub = from->subarray; sub; sub = sub->subarray)
|
for (sub = from->subarray; sub; sub = sub->subarray)
|
||||||
/* If source array has degraded subarrays, don't
|
/* If source array has degraded subarrays, don't
|
||||||
* remove anything
|
* remove anything
|
||||||
|
@ -806,7 +815,7 @@ static int container_choose_spare(struct state *from, struct state *to,
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct supertype *st = from->metadata;
|
struct supertype *st = from->metadata;
|
||||||
int fd = open(st->devname, O_RDONLY);
|
int fd = open(from->devname, O_RDONLY);
|
||||||
int err;
|
int err;
|
||||||
struct mdinfo *disks, *d;
|
struct mdinfo *disks, *d;
|
||||||
unsigned long long min_size
|
unsigned long long min_size
|
||||||
|
|
Loading…
Reference in New Issue