Monitor: skip array if error getting size
load_super tries to load container first anyway but if it fails eg. after physically removing a disk then it tries to read metadata from container device. This will always fail and print confusing errors. So use load_container instead of load_super on container. On failure to read metadata we should skip this array. It will be dealt with the next time round. Signed-off-by: Anna Czarnowska <anna.czarnowska@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
2dd0d6971c
commit
de697acc4c
21
Monitor.c
21
Monitor.c
|
@ -702,24 +702,28 @@ static int add_new_arrays(struct mdstat_ent *mdstat, struct state **statelist,
|
||||||
return new_found;
|
return new_found;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long long min_spare_size_required(struct state *st)
|
static int get_min_spare_size_required(struct state *st, unsigned long long *sizep)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
unsigned long long rv = 0;
|
|
||||||
|
|
||||||
if (!st->metadata ||
|
if (!st->metadata ||
|
||||||
!st->metadata->ss->min_acceptable_spare_size)
|
!st->metadata->ss->min_acceptable_spare_size)
|
||||||
return rv;
|
return 0;
|
||||||
|
|
||||||
fd = open(st->devname, O_RDONLY);
|
fd = open(st->devname, O_RDONLY);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return 0;
|
return 1;
|
||||||
st->metadata->ss->load_super(st->metadata, fd, st->devname);
|
if (st->metadata->ss->external)
|
||||||
|
st->metadata->ss->load_container(st->metadata, fd, st->devname);
|
||||||
|
else
|
||||||
|
st->metadata->ss->load_super(st->metadata, fd, st->devname);
|
||||||
close(fd);
|
close(fd);
|
||||||
rv = st->metadata->ss->min_acceptable_spare_size(st->metadata);
|
if (!st->metadata->sb)
|
||||||
|
return 1;
|
||||||
|
*sizep = st->metadata->ss->min_acceptable_spare_size(st->metadata);
|
||||||
st->metadata->ss->free_super(st->metadata);
|
st->metadata->ss->free_super(st->metadata);
|
||||||
|
|
||||||
return rv;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int check_donor(struct state *from, struct state *to)
|
static int check_donor(struct state *from, struct state *to)
|
||||||
|
@ -833,7 +837,8 @@ static void try_spare_migration(struct state *statelist, struct alert_info *info
|
||||||
/* member of a container */
|
/* member of a container */
|
||||||
to = to->parent;
|
to = to->parent;
|
||||||
|
|
||||||
min_size = min_spare_size_required(to);
|
if (get_min_spare_size_required(to, &min_size))
|
||||||
|
continue;
|
||||||
if (to->metadata->ss->external) {
|
if (to->metadata->ss->external) {
|
||||||
/* We must make sure there is
|
/* We must make sure there is
|
||||||
* no suitable spare in container already.
|
* no suitable spare in container already.
|
||||||
|
|
Loading…
Reference in New Issue