Linux RAID subsystem development
 help / color / mirror / Atom feed
* [PATCH v2 1/2] md/raid5: Add change_consistency_policy to raid4 and raid6
@ 2017-03-16 22:14 Song Liu
  2017-03-16 22:14 ` [PATCH v2 2/2] md/raid5: use consistency_policy to remove journal feature Song Liu
  2017-03-24 14:45 ` [PATCH v2 1/2] md/raid5: Add change_consistency_policy to raid4 and raid6 Shaohua Li
  0 siblings, 2 replies; 6+ messages in thread
From: Song Liu @ 2017-03-16 22:14 UTC (permalink / raw)
  To: linux-raid
  Cc: shli, neilb, kernel-team, dan.j.williams, hch, jes.sorensen,
	Song Liu

Add change_consistency_policy to raid6_personality and
raid4_personality.

Signed-off-by: Song Liu <songliubraving@fb.com>
---
 drivers/md/raid5.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 88cc898..7a6e7ea 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -8408,6 +8408,7 @@ static struct md_personality raid6_personality =
 	.quiesce	= raid5_quiesce,
 	.takeover	= raid6_takeover,
 	.congested	= raid5_congested,
+	.change_consistency_policy = raid5_change_consistency_policy,
 };
 static struct md_personality raid5_personality =
 {
@@ -8456,6 +8457,7 @@ static struct md_personality raid4_personality =
 	.quiesce	= raid5_quiesce,
 	.takeover	= raid4_takeover,
 	.congested	= raid5_congested,
+	.change_consistency_policy = raid5_change_consistency_policy,
 };
 
 static int __init raid5_init(void)
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH v2 2/2] md/raid5: use consistency_policy to remove journal feature
  2017-03-16 22:14 [PATCH v2 1/2] md/raid5: Add change_consistency_policy to raid4 and raid6 Song Liu
@ 2017-03-16 22:14 ` Song Liu
  2017-03-24 14:48   ` Shaohua Li
  2017-03-24 14:45 ` [PATCH v2 1/2] md/raid5: Add change_consistency_policy to raid4 and raid6 Shaohua Li
  1 sibling, 1 reply; 6+ messages in thread
From: Song Liu @ 2017-03-16 22:14 UTC (permalink / raw)
  To: linux-raid
  Cc: shli, neilb, kernel-team, dan.j.williams, hch, jes.sorensen,
	Song Liu

When journal device of an array fails, the array is forced into read-only
mode. To make the array normal without adding another journal device, we
need to remove journal _feature_ from the array.

This patch allows remove journal _feature_ from an array, For journal
existing journal should be either missing or faulty.

To remove journal feature, one can simply echo into the sysfs file:

 cat /sys/block/md0/md/consistency_policy
 journal

 echo resync > /sys/block/md0/md/consistency_policy
 cat /sys/block/md0/md/consistency_policy
 resync

Signed-off-by: Song Liu <songliubraving@fb.com>
---
 drivers/md/raid5.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 7a6e7ea..2302ec4 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -8369,11 +8369,19 @@ static int raid5_change_consistency_policy(struct mddev *mddev, const char *buf)
 		if (!err)
 			raid5_reset_stripe_cache(mddev);
 		mddev_resume(mddev);
-	} else if (strncmp(buf, "resync", 6) == 0 && raid5_has_ppl(conf)) {
-		mddev_suspend(mddev);
-		log_exit(conf);
-		raid5_reset_stripe_cache(mddev);
-		mddev_resume(mddev);
+	} else if (strncmp(buf, "resync", 6) == 0) {
+		if (raid5_has_ppl(conf)) {
+			mddev_suspend(mddev);
+			log_exit(conf);
+			raid5_reset_stripe_cache(mddev);
+			mddev_resume(mddev);
+		} else if (test_bit(MD_HAS_JOURNAL, &conf->mddev->flags) &&
+			   r5l_log_disk_error(conf)) {
+			mddev_suspend(mddev);
+			clear_bit(MD_HAS_JOURNAL, &mddev->flags);
+			mddev_resume(mddev);
+		} else
+			err = -EINVAL;
 	} else {
 		err = -EINVAL;
 	}
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] md/raid5: Add change_consistency_policy to raid4 and raid6
  2017-03-16 22:14 [PATCH v2 1/2] md/raid5: Add change_consistency_policy to raid4 and raid6 Song Liu
  2017-03-16 22:14 ` [PATCH v2 2/2] md/raid5: use consistency_policy to remove journal feature Song Liu
@ 2017-03-24 14:45 ` Shaohua Li
  2017-03-24 15:17   ` Artur Paszkiewicz
  1 sibling, 1 reply; 6+ messages in thread
From: Shaohua Li @ 2017-03-24 14:45 UTC (permalink / raw)
  To: Song Liu
  Cc: linux-raid, shli, neilb, kernel-team, dan.j.williams, hch,
	jes.sorensen

On Thu, Mar 16, 2017 at 03:14:08PM -0700, Song Liu wrote:
> Add change_consistency_policy to raid6_personality and
> raid4_personality.
> 
> Signed-off-by: Song Liu <songliubraving@fb.com>
> ---
>  drivers/md/raid5.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index 88cc898..7a6e7ea 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -8408,6 +8408,7 @@ static struct md_personality raid6_personality =
>  	.quiesce	= raid5_quiesce,
>  	.takeover	= raid6_takeover,
>  	.congested	= raid5_congested,
> +	.change_consistency_policy = raid5_change_consistency_policy,
>  };
>  static struct md_personality raid5_personality =
>  {
> @@ -8456,6 +8457,7 @@ static struct md_personality raid4_personality =
>  	.quiesce	= raid5_quiesce,
>  	.takeover	= raid4_takeover,
>  	.congested	= raid5_congested,
> +	.change_consistency_policy = raid5_change_consistency_policy,
>  };
sorry for the late reply.

the change_consistency_policy is only for raid5 for a reason, ppl is only for
raid5. I think you need to filter out raid 4/6 in
raid5_change_consistency_policy for ppl.

Thanks,
Shaohua
>  
>  static int __init raid5_init(void)
> -- 
> 2.9.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 2/2] md/raid5: use consistency_policy to remove journal feature
  2017-03-16 22:14 ` [PATCH v2 2/2] md/raid5: use consistency_policy to remove journal feature Song Liu
@ 2017-03-24 14:48   ` Shaohua Li
  0 siblings, 0 replies; 6+ messages in thread
From: Shaohua Li @ 2017-03-24 14:48 UTC (permalink / raw)
  To: Song Liu
  Cc: linux-raid, shli, neilb, kernel-team, dan.j.williams, hch,
	jes.sorensen

On Thu, Mar 16, 2017 at 03:14:09PM -0700, Song Liu wrote:
> When journal device of an array fails, the array is forced into read-only
> mode. To make the array normal without adding another journal device, we
> need to remove journal _feature_ from the array.
> 
> This patch allows remove journal _feature_ from an array, For journal
> existing journal should be either missing or faulty.
> 
> To remove journal feature, one can simply echo into the sysfs file:
> 
>  cat /sys/block/md0/md/consistency_policy
>  journal
> 
>  echo resync > /sys/block/md0/md/consistency_policy
>  cat /sys/block/md0/md/consistency_policy
>  resync

please describe the detail steps what you want to do after a journal disk
failure here, like remove the disk. maybe create a new test case too.

> 
> Signed-off-by: Song Liu <songliubraving@fb.com>
> ---
>  drivers/md/raid5.c | 18 +++++++++++++-----
>  1 file changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index 7a6e7ea..2302ec4 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -8369,11 +8369,19 @@ static int raid5_change_consistency_policy(struct mddev *mddev, const char *buf)
>  		if (!err)
>  			raid5_reset_stripe_cache(mddev);
>  		mddev_resume(mddev);
> -	} else if (strncmp(buf, "resync", 6) == 0 && raid5_has_ppl(conf)) {
> -		mddev_suspend(mddev);
> -		log_exit(conf);
> -		raid5_reset_stripe_cache(mddev);
> -		mddev_resume(mddev);
> +	} else if (strncmp(buf, "resync", 6) == 0) {
> +		if (raid5_has_ppl(conf)) {
> +			mddev_suspend(mddev);
> +			log_exit(conf);
> +			raid5_reset_stripe_cache(mddev);
> +			mddev_resume(mddev);
> +		} else if (test_bit(MD_HAS_JOURNAL, &conf->mddev->flags) &&
> +			   r5l_log_disk_error(conf)) {
> +			mddev_suspend(mddev);
> +			clear_bit(MD_HAS_JOURNAL, &mddev->flags);
> +			mddev_resume(mddev);

should this happen after journal disk is removed? I'm wondering if this need
extra checks.

Thanks,
Shaohua

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] md/raid5: Add change_consistency_policy to raid4 and raid6
  2017-03-24 14:45 ` [PATCH v2 1/2] md/raid5: Add change_consistency_policy to raid4 and raid6 Shaohua Li
@ 2017-03-24 15:17   ` Artur Paszkiewicz
  2017-03-24 17:08     ` Shaohua Li
  0 siblings, 1 reply; 6+ messages in thread
From: Artur Paszkiewicz @ 2017-03-24 15:17 UTC (permalink / raw)
  To: Shaohua Li, Song Liu
  Cc: linux-raid, shli, neilb, kernel-team, dan.j.williams, hch,
	jes.sorensen

On 03/24/2017 03:45 PM, Shaohua Li wrote:
> On Thu, Mar 16, 2017 at 03:14:08PM -0700, Song Liu wrote:
>> Add change_consistency_policy to raid6_personality and
>> raid4_personality.
>>
>> Signed-off-by: Song Liu <songliubraving@fb.com>
>> ---
>>  drivers/md/raid5.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
>> index 88cc898..7a6e7ea 100644
>> --- a/drivers/md/raid5.c
>> +++ b/drivers/md/raid5.c
>> @@ -8408,6 +8408,7 @@ static struct md_personality raid6_personality =
>>  	.quiesce	= raid5_quiesce,
>>  	.takeover	= raid6_takeover,
>>  	.congested	= raid5_congested,
>> +	.change_consistency_policy = raid5_change_consistency_policy,
>>  };
>>  static struct md_personality raid5_personality =
>>  {
>> @@ -8456,6 +8457,7 @@ static struct md_personality raid4_personality =
>>  	.quiesce	= raid5_quiesce,
>>  	.takeover	= raid4_takeover,
>>  	.congested	= raid5_congested,
>> +	.change_consistency_policy = raid5_change_consistency_policy,
>>  };
> sorry for the late reply.
> 
> the change_consistency_policy is only for raid5 for a reason, ppl is only for
> raid5. I think you need to filter out raid 4/6 in
> raid5_change_consistency_policy for ppl.

Not necessarily. There is a check in ppl_init_log() that won't allow
starting ppl if it's not raid5. But it certainly wouldn't hurt.

Thanks,
Artur

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] md/raid5: Add change_consistency_policy to raid4 and raid6
  2017-03-24 15:17   ` Artur Paszkiewicz
@ 2017-03-24 17:08     ` Shaohua Li
  0 siblings, 0 replies; 6+ messages in thread
From: Shaohua Li @ 2017-03-24 17:08 UTC (permalink / raw)
  To: Artur Paszkiewicz
  Cc: Song Liu, linux-raid, shli, neilb, kernel-team, dan.j.williams,
	hch, jes.sorensen

On Fri, Mar 24, 2017 at 04:17:16PM +0100, Artur Paszkiewicz wrote:
> On 03/24/2017 03:45 PM, Shaohua Li wrote:
> > On Thu, Mar 16, 2017 at 03:14:08PM -0700, Song Liu wrote:
> >> Add change_consistency_policy to raid6_personality and
> >> raid4_personality.
> >>
> >> Signed-off-by: Song Liu <songliubraving@fb.com>
> >> ---
> >>  drivers/md/raid5.c | 2 ++
> >>  1 file changed, 2 insertions(+)
> >>
> >> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> >> index 88cc898..7a6e7ea 100644
> >> --- a/drivers/md/raid5.c
> >> +++ b/drivers/md/raid5.c
> >> @@ -8408,6 +8408,7 @@ static struct md_personality raid6_personality =
> >>  	.quiesce	= raid5_quiesce,
> >>  	.takeover	= raid6_takeover,
> >>  	.congested	= raid5_congested,
> >> +	.change_consistency_policy = raid5_change_consistency_policy,
> >>  };
> >>  static struct md_personality raid5_personality =
> >>  {
> >> @@ -8456,6 +8457,7 @@ static struct md_personality raid4_personality =
> >>  	.quiesce	= raid5_quiesce,
> >>  	.takeover	= raid4_takeover,
> >>  	.congested	= raid5_congested,
> >> +	.change_consistency_policy = raid5_change_consistency_policy,
> >>  };
> > sorry for the late reply.
> > 
> > the change_consistency_policy is only for raid5 for a reason, ppl is only for
> > raid5. I think you need to filter out raid 4/6 in
> > raid5_change_consistency_policy for ppl.
> 
> Not necessarily. There is a check in ppl_init_log() that won't allow
> starting ppl if it's not raid5. But it certainly wouldn't hurt.

It will still set the PPL flag for raid4/6. Checking raid 5 in
change_consistency_policy is clearer anyway.

Thanks,
Shaohua

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-03-24 17:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-16 22:14 [PATCH v2 1/2] md/raid5: Add change_consistency_policy to raid4 and raid6 Song Liu
2017-03-16 22:14 ` [PATCH v2 2/2] md/raid5: use consistency_policy to remove journal feature Song Liu
2017-03-24 14:48   ` Shaohua Li
2017-03-24 14:45 ` [PATCH v2 1/2] md/raid5: Add change_consistency_policy to raid4 and raid6 Shaohua Li
2017-03-24 15:17   ` Artur Paszkiewicz
2017-03-24 17:08     ` Shaohua Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox