]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
super: make sure to ignore disk state flags that we don't understand.
authorNeilBrown <neilb@suse.de>
Thu, 7 Aug 2014 01:34:50 +0000 (11:34 +1000)
committerNeilBrown <neilb@suse.de>
Thu, 7 Aug 2014 01:34:50 +0000 (11:34 +1000)
This make it easier to add new flags that some super-types
don't understand.

Signed-off-by: NeilBrown <neilb@suse.de>
super0.c
super1.c

index 3218377f74f4d72e12b4a6f4559d8041264ff0c6..1c203927fb74fc49a0652b6f62049caa7b3e9875 100644 (file)
--- a/super0.c
+++ b/super0.c
@@ -805,9 +805,8 @@ static int add_to_super0(struct supertype *st, mdu_disk_info_t *dinfo,
        dk->major = dinfo->major;
        dk->minor = dinfo->minor;
        dk->raid_disk = dinfo->raid_disk;
-       dk->state = dinfo->state;
-       /* In case our source disk was writemostly, don't copy that bit */
-       dk->state &= ~(1<<MD_DISK_WRITEMOSTLY);
+       dk->state = dinfo->state & ((1<<MD_DISK_ACTIVE) |
+                                   (1<<MD_DISK_SYNC));
 
        sb->this_disk = sb->disks[dinfo->number];
        sb->sb_csum = calc_sb0_csum(sb);
@@ -887,7 +886,7 @@ static int write_init_super0(struct supertype *st)
 
        for (di = st->info ; di && ! rv ; di = di->next) {
 
-               if (di->disk.state == 1)
+               if (di->disk.state & (1 << MD_DISK_FAULTY))
                        continue;
                if (di->fd == -1)
                        continue;
index 7cf9b518a41ff98bdd89ce891ac6dd3bd75b33fc..7fba9be0a252a868a579f732fc4bd8a39d503797 100644 (file)
--- a/super1.c
+++ b/super1.c
@@ -1557,7 +1557,7 @@ static int write_init_super1(struct supertype *st)
        unsigned long long data_offset;
 
        for (di = st->info; di; di = di->next) {
-               if (di->disk.state == 1)
+               if (di->disk.state & (1 << MD_DISK_FAULTY))
                        continue;
                if (di->fd < 0)
                        continue;