summaryrefslogtreecommitdiffstats
path: root/super-intel.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2009-02-23 14:26:11 -0700
committerDan Williams <dan.j.williams@intel.com>2009-02-23 23:06:24 -0700
commit7a70e8aa8d47376ca37a1fe2c38f1db5c14aa36d (patch)
treee18d713c98638d397fb4b354e51ef4d4f96ead89 /super-intel.c
parent689c9bf3c3976a7eda5566291332c513f3dc133b (diff)
downloadmdadm-7a70e8aa8d47376ca37a1fe2c38f1db5c14aa36d.tar.gz
mdadm-7a70e8aa8d47376ca37a1fe2c38f1db5c14aa36d.tar.xz
mdadm-7a70e8aa8d47376ca37a1fe2c38f1db5c14aa36d.zip
imsm: fixup container spare uuids by default
Spares in the imsm case are marked with the "match-all" uuid of ffffffff-ffffffff-ffffffff-ffffffff. When performing incremental assembly we need to associate such devices with a populated container uuid. Also when performing --detail on a container with only spares present we can make an attempt to return a real uuid. Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'super-intel.c')
-rw-r--r--super-intel.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/super-intel.c b/super-intel.c
index 4e75132..be01f32 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -1152,6 +1152,32 @@ static void getinfo_super_imsm_volume(struct supertype *st, struct mdinfo *info)
uuid_from_super_imsm(st, info->uuid);
}
+/* check the config file to see if we can return a real uuid for this spare */
+static void fixup_container_spare_uuid(struct mdinfo *inf)
+{
+ struct mddev_ident_s *array_list;
+
+ if (inf->array.level != LEVEL_CONTAINER ||
+ memcmp(inf->uuid, uuid_match_any, sizeof(int[4])) != 0)
+ return;
+
+ array_list = conf_get_ident(NULL);
+
+ for (; array_list; array_list = array_list->next) {
+ if (array_list->uuid_set) {
+ struct supertype *_sst; /* spare supertype */
+ struct supertype *_cst; /* container supertype */
+
+ _cst = array_list->st;
+ _sst = _cst->ss->match_metadata_desc(inf->text_version);
+ if (_sst) {
+ memcpy(inf->uuid, array_list->uuid, sizeof(int[4]));
+ free(_sst);
+ break;
+ }
+ }
+ }
+}
static void getinfo_super_imsm(struct supertype *st, struct mdinfo *info)
{
@@ -1207,8 +1233,10 @@ static void getinfo_super_imsm(struct supertype *st, struct mdinfo *info)
*/
if (info->disk.state & (1 << MD_DISK_SYNC) || super->anchor->num_raid_devs)
uuid_from_super_imsm(st, info->uuid);
- else
+ else {
memcpy(info->uuid, uuid_match_any, sizeof(int[4]));
+ fixup_container_spare_uuid(info);
+ }
}
static int update_super_imsm(struct supertype *st, struct mdinfo *info,