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


Groups > linux.kernel > #1603451 > unrolled thread

[PATCH 0/2] mdadm: setting device role of raid1 disk with failfast

Started byGioh Kim <gi-oh.kim@profitbricks.com>
First post2017-03-17 17:50 +0100
Last post2017-03-17 17:50 +0100
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/2] mdadm: setting device role of raid1 disk with failfast Gioh Kim <gi-oh.kim@profitbricks.com> - 2017-03-17 17:50 +0100
    [PATCH 1/2] super1: ignore failfast flag for setting device role Gioh Kim <gi-oh.kim@profitbricks.com> - 2017-03-17 17:50 +0100
      Re: [PATCH 1/2] super1: ignore failfast flag for setting device role jes.sorensen@gmail.com - 2017-03-17 21:30 +0100
    [PATCH 2/2] super1: check and output faulty dev role Gioh Kim <gi-oh.kim@profitbricks.com> - 2017-03-17 17:50 +0100

#1603451 — [PATCH 0/2] mdadm: setting device role of raid1 disk with failfast

FromGioh Kim <gi-oh.kim@profitbricks.com>
Date2017-03-17 17:50 +0100
Subject[PATCH 0/2] mdadm: setting device role of raid1 disk with failfast
Message-ID<tm3eF-UG-1@gated-at.bofh.it>
Hi,

I've found a case that failfast option of mdadm set a disk faulty wrongly.
Following is my test case.

mdadm --create /dev/md100 -l 1 --failfast -e 1.2 -n 2 /dev/vdb /dev/vdc
mdadm /dev/md100 -a --failfast /dev/vdd

If I use failfast option, the vdd disk was faulty wrongly.
If not, it was spare.

This patch fixes a corner case for setting device role and
prints device role if it's faulty.
This patch is based on "mdadm - v4.0-8-g72b616a - 2017-03-07".

Gioh Kim (1):
  super1: ignore failfast flag for setting device role

Jack Wang (1):
  super1: check and output faulty dev role

 super1.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

-- 
2.5.0

[toc] | [next] | [standalone]


#1603452 — [PATCH 1/2] super1: ignore failfast flag for setting device role

FromGioh Kim <gi-oh.kim@profitbricks.com>
Date2017-03-17 17:50 +0100
Subject[PATCH 1/2] super1: ignore failfast flag for setting device role
Message-ID<tm3eF-UG-5@gated-at.bofh.it>
In reply to#1603451
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..1da33ef 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 &= ~(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

[toc] | [prev] | [next] | [standalone]


#1603609 — Re: [PATCH 1/2] super1: ignore failfast flag for setting device role

Fromjes.sorensen@gmail.com
Date2017-03-17 21:30 +0100
SubjectRe: [PATCH 1/2] super1: ignore failfast flag for setting device role
Message-ID<tm6Fz-3yq-15@gated-at.bofh.it>
In reply to#1603452
Gioh Kim <gi-oh.kim@profitbricks.com> writes:
> 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..1da33ef 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 &= ~(1<<MD_DISK_FAILFAST);
> +	if ((dk_state & 6) == 6) /* active, sync */
>  		*rp = __cpu_to_le16(dk->raid_disk);

This does not look right - you haven't assigned a value to dk_state, but
then start masking bits out of it.

Cheers,
Jes

[toc] | [prev] | [next] | [standalone]


#1603454 — [PATCH 2/2] super1: check and output faulty dev role

FromGioh Kim <gi-oh.kim@profitbricks.com>
Date2017-03-17 17:50 +0100
Subject[PATCH 2/2] super1: check and output faulty dev role
Message-ID<tm3eG-UG-11@gated-at.bofh.it>
In reply to#1603451
From: Jack Wang <jinpu.wang@profitbricks.com>

Output the real dev role in examine_super1, it will help to
find problem.

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

diff --git a/super1.c b/super1.c
index 1da33ef..0bf4715 100644
--- a/super1.c
+++ b/super1.c
@@ -501,8 +501,10 @@ static void examine_super1(struct supertype *st, char *homehost)
 #endif
 	printf("   Device Role : ");
 	role = role_from_sb(sb);
-	if (role >= MD_DISK_ROLE_FAULTY)
-		printf("spare\n");
+	if (role == MD_DISK_ROLE_SPARE)
+		printf("Spare\n");
+	else if (role == MD_DISK_ROLE_FAULTY)
+		printf("Faulty\n");
 	else if (role == MD_DISK_ROLE_JOURNAL)
 		printf("Journal\n");
 	else if (sb->feature_map & __cpu_to_le32(MD_FEATURE_REPLACEMENT))
-- 
2.5.0

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web