diff options
author | Gioh Kim <gi-oh.kim@profitbricks.com> | 2017-03-20 10:51:56 +0100 |
---|---|---|
committer | Jes Sorensen <Jes.Sorensen@gmail.com> | 2017-03-28 19:59:03 +0200 |
commit | e23c2663da73f905aa5fa9800feda3d08a8026ee (patch) | |
tree | fff2271a26e99ec8699a55fce669ed181fe82894 /super1.c | |
parent | mdadm: Forced type conversion to avoid truncation (diff) | |
download | mdadm-e23c2663da73f905aa5fa9800feda3d08a8026ee.tar.xz mdadm-e23c2663da73f905aa5fa9800feda3d08a8026ee.zip |
super1: ignore failfast flag for setting device role
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>
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
Diffstat (limited to '')
-rw-r--r-- | super1.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -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; |