]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super-ddf.c
IMSM/DDF: don't recognised these metadata on partitions.
[thirdparty/mdadm.git] / super-ddf.c
index f5eb816fbce368482cccd8ed356b7a5e7828eee2..0e6f1e53394de81a9aace6a3a5c8999ed00cb2a0 100644 (file)
@@ -783,6 +783,10 @@ static int load_super_ddf(struct supertype *st, int fd,
        if (get_dev_size(fd, devname, &dsize) == 0)
                return 1;
 
+       if (test_partition(fd))
+               /* DDF is not allowed on partitions */
+               return 1;
+
        /* 32M is a lower bound */
        if (dsize <= 32*1024*1024) {
                if (devname)
@@ -1260,7 +1264,11 @@ static int match_home_ddf(struct supertype *st, char *homehost)
         * the hostname
         */
        struct ddf_super *ddf = st->sb;
-       int len = strlen(homehost);
+       int len;
+
+       if (!homehost)
+               return 0;
+       len = strlen(homehost);
 
        return (memcmp(ddf->controller.guid, T10, 8) == 0 &&
                len < sizeof(ddf->controller.vendor_data) &&
@@ -1369,6 +1377,7 @@ static void getinfo_super_ddf(struct supertype *st, struct mdinfo *info)
        info->disk.state = (1 << MD_DISK_SYNC) | (1 << MD_DISK_ACTIVE);
 
 
+       info->recovery_start = MaxSector;
        info->reshape_active = 0;
        info->name[0] = 0;
 
@@ -1427,13 +1436,15 @@ static void getinfo_super_ddf_bvd(struct supertype *st, struct mdinfo *info)
 
        info->container_member = ddf->currentconf->vcnum;
 
+       info->recovery_start = MaxSector;
        info->resync_start = 0;
+       info->reshape_active = 0;
        if (!(ddf->virt->entries[info->container_member].state
              & DDF_state_inconsistent)  &&
            (ddf->virt->entries[info->container_member].init_state
             & DDF_initstate_mask)
            == DDF_init_full)
-               info->resync_start = ~0ULL;
+               info->resync_start = MaxSector;
 
        uuid_from_super_ddf(st, info->uuid);
 
@@ -1739,7 +1750,7 @@ static int init_super_ddf(struct supertype *st,
 
        memset(pd, 0xff, pdsize);
        memset(pd, 0, sizeof(*pd));
-       pd->magic = DDF_PHYS_DATA_MAGIC;
+       pd->magic = DDF_PHYS_RECORDS_MAGIC;
        pd->used_pdes = __cpu_to_be16(0);
        pd->max_pdes = __cpu_to_be16(max_phys_disks);
        memset(pd->pad, 0xff, 52);
@@ -2406,8 +2417,12 @@ static int write_init_super_ddf(struct supertype *st)
 
                /* FIXME I need to close the fds! */
                return 0;
-       } else 
+       } else {        
+               struct dl *d;
+               for (d = ddf->dlist; d; d=d->next)
+                       while (Kill(d->devname, NULL, 0, 1, 1) == 0);
                return __write_init_super_ddf(st, 1);
+       }
 }
 
 #endif
@@ -2921,7 +2936,7 @@ static struct mdinfo *container_content_ddf(struct supertype *st)
                        this->resync_start = 0;
                } else {
                        this->array.state = 1;
-                       this->resync_start = ~0ULL;
+                       this->resync_start = MaxSector;
                }
                memcpy(this->name, ddf->virt->entries[i].name, 16);
                this->name[16]=0;
@@ -2968,6 +2983,7 @@ static struct mdinfo *container_content_ddf(struct supertype *st)
                        dev->disk.minor = d->minor;
                        dev->disk.raid_disk = i;
                        dev->disk.state = (1<<MD_DISK_SYNC)|(1<<MD_DISK_ACTIVE);
+                       dev->recovery_start = MaxSector;
 
                        dev->events = __be32_to_cpu(ddf->primary.seq);
                        dev->data_offset = __be64_to_cpu(vc->lba_offset[i]);
@@ -3547,6 +3563,7 @@ static struct mdinfo *ddf_activate_spare(struct active_array *a,
                        di->disk.major = dl->major;
                        di->disk.minor = dl->minor;
                        di->disk.state = 0;
+                       di->recovery_start = 0;
                        di->data_offset = pos;
                        di->component_size = a->info.component_size;
                        di->container_member = dl->pdnum;