Allow a uuid of all f's to always match
The uuid returned for an imsm spare device will never match the uuid of an active disk. So make mdadm interpret a uuid of all f's as "match any". Signed-off-by: Dan Williams <dan.j.williams@intel.com>
This commit is contained in:
parent
27fd627414
commit
36ba7d4849
1
mdadm.h
1
mdadm.h
|
@ -767,6 +767,7 @@ extern char *conf_word(FILE *file, int allow_key);
|
|||
extern void free_line(char *line);
|
||||
extern int match_oneof(char *devices, char *devname);
|
||||
extern void uuid_from_super(int uuid[4], mdp_super_t *super);
|
||||
extern const int uuid_match_any[4];
|
||||
extern int same_uuid(int a[4], int b[4], int swapuuid);
|
||||
extern void copy_uuid(void *a, int b[4], int swapuuid);
|
||||
extern char *fname_from_uuid(struct supertype *st,
|
||||
|
|
|
@ -785,6 +785,7 @@ static void getinfo_super_imsm(struct supertype *st, struct mdinfo *info)
|
|||
struct intel_super *super = st->sb;
|
||||
struct imsm_disk *disk;
|
||||
__u32 s;
|
||||
int is_spare = 0;
|
||||
|
||||
if (super->current_vol >= 0) {
|
||||
getinfo_super_imsm_volume(st, info);
|
||||
|
@ -826,8 +827,13 @@ static void getinfo_super_imsm(struct supertype *st, struct mdinfo *info)
|
|||
info->disk.state = s & CONFIGURED_DISK ? (1 << MD_DISK_ACTIVE) : 0;
|
||||
info->disk.state |= s & FAILED_DISK ? (1 << MD_DISK_FAULTY) : 0;
|
||||
info->disk.state |= s & USABLE_DISK ? (1 << MD_DISK_SYNC) : 0;
|
||||
if (s & SPARE_DISK)
|
||||
is_spare = 1;
|
||||
}
|
||||
uuid_from_super_imsm(st, info->uuid);
|
||||
if (is_spare)
|
||||
memcpy(info->uuid, uuid_match_any, sizeof(int[4]));
|
||||
else
|
||||
uuid_from_super_imsm(st, info->uuid);
|
||||
}
|
||||
|
||||
static int update_super_imsm(struct supertype *st, struct mdinfo *info,
|
||||
|
|
5
util.c
5
util.c
|
@ -222,8 +222,13 @@ int enough(int level, int raid_disks, int layout, int clean,
|
|||
}
|
||||
}
|
||||
|
||||
const int uuid_match_any[4] = { ~0, ~0, ~0, ~0 };
|
||||
int same_uuid(int a[4], int b[4], int swapuuid)
|
||||
{
|
||||
if (memcmp(a, uuid_match_any, sizeof(int[4])) == 0 ||
|
||||
memcmp(b, uuid_match_any, sizeof(int[4])) == 0)
|
||||
return 1;
|
||||
|
||||
if (swapuuid) {
|
||||
/* parse uuids are hostendian.
|
||||
* uuid's from some superblocks are big-ending
|
||||
|
|
Loading…
Reference in New Issue