Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1604303

[PATCHv2 1/2] super1: ignore failfast flag for setting device role

From Gioh Kim <gi-oh.kim@profitbricks.com>
Newsgroups linux.kernel
Subject [PATCHv2 1/2] super1: ignore failfast flag for setting device role
Date 2017-03-20 11:00 +0100
Message-ID <tn2gy-2R9-17@gated-at.bofh.it> (permalink)
References <tn2gy-2R9-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


There is corner case for setting device role,
if new device has failfast flag.
The failfast flag should be ignored.

Signed-off-by: Gioh Kim <gi-oh.kim@profitbricks.com>
Signed-off-by: Jack Wang <jinpu.wang@profitbricks.com>
---
 super1.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/super1.c b/super1.c
index 882cd61..f3520ac 100644
--- a/super1.c
+++ b/super1.c
@@ -1491,6 +1491,7 @@ static int add_to_super1(struct supertype *st, mdu_disk_info_t *dk,
 	struct devinfo *di, **dip;
 	bitmap_super_t *bms = (bitmap_super_t*)(((char*)sb) + MAX_SB_SIZE);
 	int rv, lockid;
+	int dk_state;
 
 	if (bms->version == BITMAP_MAJOR_CLUSTERED && dlm_funs_ready()) {
 		rv = cluster_get_dlmlock(&lockid);
@@ -1501,11 +1502,12 @@ static int add_to_super1(struct supertype *st, mdu_disk_info_t *dk,
 		}
 	}
 
-	if ((dk->state & 6) == 6) /* active, sync */
+	dk_state = dk->state & ~(1<<MD_DISK_FAILFAST);
+	if ((dk_state & 6) == 6) /* active, sync */
 		*rp = __cpu_to_le16(dk->raid_disk);
-	else if (dk->state & (1<<MD_DISK_JOURNAL))
+	else if (dk_state & (1<<MD_DISK_JOURNAL))
                 *rp = MD_DISK_ROLE_JOURNAL;
-	else if ((dk->state & ~2) == 0) /* active or idle -> spare */
+	else if ((dk_state & ~2) == 0) /* active or idle -> spare */
 		*rp = MD_DISK_ROLE_SPARE;
 	else
 		*rp = MD_DISK_ROLE_FAULTY;
-- 
2.5.0

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCHv2 0/2] mdadm: setting device role of raid1 disk with failfast Gioh Kim <gi-oh.kim@profitbricks.com> - 2017-03-20 11:00 +0100
  [PATCHv2 1/2] super1: ignore failfast flag for setting device role Gioh Kim <gi-oh.kim@profitbricks.com> - 2017-03-20 11:00 +0100
  [PATCHv2 2/2] super1: check and output faulty dev role Gioh Kim <gi-oh.kim@profitbricks.com> - 2017-03-20 11:00 +0100
    Re: [PATCHv2 2/2] super1: check and output faulty dev role NeilBrown <neilb@suse.com> - 2017-03-21 21:50 +0100
      Re: [PATCHv2 2/2] super1: check and output faulty dev role Jinpu Wang <jinpu.wang@profitbricks.com> - 2017-03-22 11:30 +0100
  Re: [PATCHv2 0/2] mdadm: setting device role of raid1 disk with  failfast Gioh Kim <gi-oh.kim@profitbricks.com> - 2017-03-27 13:10 +0200

csiph-web