getinfo_super now clears the 'info' structure before filling it in.
Some code currently clears 'info' before calling getinfo_super, some code doesn't. To be consistent, change it so no caller ever clears 'info', but ever getinfo_super function must clear it. Note that ->raid_disk may be meaningful if that 'map' is passed non-NULL. In that case it is copied out before the structure is zeroed. Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
58b3c6976a
commit
95eeceeb32
|
@ -418,7 +418,6 @@ int Assemble(struct supertype *st, char *mddev,
|
|||
int uuid[4];
|
||||
|
||||
content = &info;
|
||||
memset(content, 0, sizeof(*content));
|
||||
tst->ss->getinfo_super(tst, content, NULL);
|
||||
|
||||
if (!parse_uuid(ident->container, uuid) ||
|
||||
|
@ -484,7 +483,6 @@ int Assemble(struct supertype *st, char *mddev,
|
|||
} else {
|
||||
|
||||
content = &info;
|
||||
memset(content, 0, sizeof(*content));
|
||||
tst->ss->getinfo_super(tst, content, NULL);
|
||||
|
||||
if (!ident_matches(ident, content, tst,
|
||||
|
|
2
Create.c
2
Create.c
|
@ -658,8 +658,8 @@ int Create(struct supertype *st, char *mddev,
|
|||
goto abort;
|
||||
|
||||
total_slots = info.array.nr_disks;
|
||||
sysfs_init(&info, mdfd, 0);
|
||||
st->ss->getinfo_super(st, &info, NULL);
|
||||
sysfs_init(&info, mdfd, 0);
|
||||
|
||||
if (did_default && verbose >= 0) {
|
||||
if (is_subarray(info.text_version)) {
|
||||
|
|
|
@ -202,7 +202,6 @@ int Incremental(char *devname, int verbose, int runstop,
|
|||
}
|
||||
close (dfd); dfd = -1;
|
||||
|
||||
memset(&info, 0, sizeof(info));
|
||||
st->ss->getinfo_super(st, &info, NULL);
|
||||
|
||||
/* 3/ Check if there is a match in mdadm.conf */
|
||||
|
@ -396,7 +395,6 @@ int Incremental(char *devname, int verbose, int runstop,
|
|||
goto out;
|
||||
}
|
||||
close(dfd2);
|
||||
memset(&info2, 0, sizeof(info2));
|
||||
st2->ss->getinfo_super(st2, &info2, NULL);
|
||||
st2->ss->free_super(st2);
|
||||
if (info.array.level != info2.array.level ||
|
||||
|
@ -1435,7 +1433,6 @@ static int Incremental_container(struct supertype *st, char *devname,
|
|||
int suuid[4];
|
||||
int sfd;
|
||||
|
||||
memset(&info, 0, sizeof(info));
|
||||
st->ss->getinfo_super(st, &info, NULL);
|
||||
|
||||
if ((runstop > 0 && info.container_enough >= 0) ||
|
||||
|
|
1
mdadm.h
1
mdadm.h
|
@ -616,6 +616,7 @@ extern struct superswitch {
|
|||
* (raid_disk must already be set and correct) and it is filled
|
||||
* with 1 for slots that are thought to be active and 0 for slots which
|
||||
* appear to be failed/missing.
|
||||
* *info is zeroed out before data is added.
|
||||
*/
|
||||
void (*getinfo_super)(struct supertype *st, struct mdinfo *info, char *map);
|
||||
struct mdinfo *(*getinfo_super_disks)(struct supertype *st);
|
||||
|
|
|
@ -1341,6 +1341,7 @@ static void getinfo_super_ddf(struct supertype *st, struct mdinfo *info, char *m
|
|||
getinfo_super_ddf_bvd(st, info, map);
|
||||
return;
|
||||
}
|
||||
memset(info, 0, sizeof(*info));
|
||||
|
||||
info->array.raid_disks = __be16_to_cpu(ddf->phys->used_pdes);
|
||||
info->array.level = LEVEL_CONTAINER;
|
||||
|
@ -1406,6 +1407,7 @@ static void getinfo_super_ddf_bvd(struct supertype *st, struct mdinfo *info, cha
|
|||
struct dl *dl;
|
||||
int map_disks = info->array.raid_disks;
|
||||
|
||||
memset(info, 0, sizeof(*info));
|
||||
/* FIXME this returns BVD info - what if we want SVD ?? */
|
||||
|
||||
info->array.raid_disks = __be16_to_cpu(vc->conf.prim_elmnt_count);
|
||||
|
|
|
@ -1764,6 +1764,7 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info,
|
|||
unsigned int component_size_alligment;
|
||||
int map_disks = info->array.raid_disks;
|
||||
|
||||
memset(info, 0, sizeof(*info));
|
||||
if (prev_map)
|
||||
map_to_analyse = prev_map;
|
||||
|
||||
|
@ -1972,6 +1973,7 @@ static void getinfo_super_imsm(struct supertype *st, struct mdinfo *info, char *
|
|||
getinfo_super_imsm_volume(st, info, map);
|
||||
return;
|
||||
}
|
||||
memset(info, 0, sizeof(*info));
|
||||
|
||||
/* Set raid_disks to zero so that Assemble will always pull in valid
|
||||
* spares
|
||||
|
|
1
super0.c
1
super0.c
|
@ -346,6 +346,7 @@ static void getinfo_super0(struct supertype *st, struct mdinfo *info, char *map)
|
|||
int i;
|
||||
int map_disks = info->array.raid_disks;
|
||||
|
||||
memset(info, 0, sizeof(*info));
|
||||
info->array.major_version = sb->major_version;
|
||||
info->array.minor_version = sb->minor_version;
|
||||
info->array.patch_version = sb->patch_version;
|
||||
|
|
1
super1.c
1
super1.c
|
@ -566,6 +566,7 @@ static void getinfo_super1(struct supertype *st, struct mdinfo *info, char *map)
|
|||
unsigned int role;
|
||||
unsigned int map_disks = info->array.raid_disks;
|
||||
|
||||
memset(info, 0, sizeof(*info));
|
||||
info->array.major_version = 1;
|
||||
info->array.minor_version = st->minor_version;
|
||||
info->array.patch_version = 0;
|
||||
|
|
Loading…
Reference in New Issue