summaryrefslogtreecommitdiffstats
path: root/super0.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2014-08-07 03:34:50 +0200
committerNeilBrown <neilb@suse.de>2014-08-07 03:34:50 +0200
commitf4dc5e9b7f4226217b534023c8ede3fd50c673b5 (patch)
tree07eed9af0f09c830a947d61a302bd5e1bc819b14 /super0.c
parentDetail: Avoid dereferencing some NULL pointers. (diff)
downloadmdadm-f4dc5e9b7f4226217b534023c8ede3fd50c673b5.tar.xz
mdadm-f4dc5e9b7f4226217b534023c8ede3fd50c673b5.zip
super: make sure to ignore disk state flags that we don't understand.
This make it easier to add new flags that some super-types don't understand. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'super0.c')
-rw-r--r--super0.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/super0.c b/super0.c
index 3218377f..1c203927 100644
--- 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;