File 0015-super-make-sure-to-ignore-disk-state-flags-that-we-d.patch of Package mdadm.5365

From f4dc5e9b7f4226217b534023c8ede3fd50c673b5 Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Thu, 7 Aug 2014 11:34:50 +1000
Subject: [PATCH 021/359] super: make sure to ignore disk state flags that we
 don't understand.
References: bsc#1081910

This make it easier to add new flags that some super-types
don't understand.

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Coly Li <colyli@suse.de>

---
 super0.c | 7 +++----
 super1.c | 2 +-
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/super0.c b/super0.c
index 3218377..1c20392 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;
diff --git a/super1.c b/super1.c
index 7cf9b51..7fba9be 100644
--- 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;
-- 
2.16.1

openSUSE Build Service is sponsored by