]> git.ipfire.org Git - thirdparty/mdadm.git/blobdiff - super0.c
Create: over-ride "start_ro" setting when creating an array.
[thirdparty/mdadm.git] / super0.c
index eb902ebd1af5d0cd92b31b22f7322505efcf9aa9..1f4dc750722bafb7313fb6bf47890e270a2ce1de 100644 (file)
--- a/super0.c
+++ b/super0.c
@@ -435,6 +435,18 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
        int rv = 0;
        int uuid[4];
        mdp_super_t *sb = st->sb;
+
+       if (strcmp(update, "homehost") == 0 &&
+           homehost) {
+               /* note that 'homehost' is special as it is really
+                * a "uuid" update.
+                */
+               uuid_set = 0;
+               update = "uuid";
+               info->uuid[0] = sb->set_uuid0;
+               info->uuid[1] = sb->set_uuid1;
+       }
+
        if (strcmp(update, "sparc2.2")==0 ) {
                /* 2.2 sparc put the events in the wrong place
                 * So we copy the tail of the superblock
@@ -551,12 +563,6 @@ static int update_super0(struct supertype *st, struct mdinfo *info,
                /* make sure resync happens */
                sb->state &= ~(1<<MD_SB_CLEAN);
                sb->recovery_cp = 0;
-       } else if (strcmp(update, "homehost") == 0 &&
-                  homehost) {
-               uuid_set = 0;
-               update = "uuid";
-               info->uuid[0] = sb->set_uuid0;
-               info->uuid[1] = sb->set_uuid1;
        } else if (strcmp(update, "uuid") == 0) {
                if (!uuid_set && homehost) {
                        char buf[20];
@@ -638,9 +644,9 @@ static int init_super0(struct supertype *st, mdu_array_info_t *info,
        sb->gvalid_words = 0; /* ignored */
        sb->ctime = time(0);
        sb->level = info->level;
-       if (size != (unsigned long long)info->size)
+       sb->size = size;
+       if (size != (unsigned long long)sb->size)
                return 0;
-       sb->size = info->size;
        sb->nr_disks = info->nr_disks;
        sb->raid_disks = info->raid_disks;
        sb->md_minor = info->md_minor;
@@ -870,8 +876,6 @@ static int load_super0(struct supertype *st, int fd, char *devname)
 
        offset *= 512;
 
-       ioctl(fd, BLKFLSBUF, 0); /* make sure we read current data */
-
        if (lseek64(fd, offset, 0)< 0LL) {
                if (devname)
                        pr_err("Cannot seek to superblock on %s: %s\n",
@@ -949,7 +953,7 @@ static struct supertype *match_metadata_desc0(char *arg)
 {
        struct supertype *st = xcalloc(1, sizeof(*st));
 
-       st->container_dev = NoMdDev;
+       st->container_devnm[0] = 0;
        st->ss = &super0;
        st->info = NULL;
        st->minor_version = 90;