diff options
author | NeilBrown <neilb@suse.de> | 2014-08-07 03:34:50 +0200 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2014-08-07 03:34:50 +0200 |
commit | f4dc5e9b7f4226217b534023c8ede3fd50c673b5 (patch) | |
tree | 07eed9af0f09c830a947d61a302bd5e1bc819b14 /super0.c | |
parent | Detail: Avoid dereferencing some NULL pointers. (diff) | |
download | mdadm-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.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -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; |