public inbox for linux-raid@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] raid5: guarantee enough stripes to avoid reshape hang
@ 2016-08-30 17:29 Shaohua Li
  2016-08-31  8:05 ` NeilBrown
  0 siblings, 1 reply; 2+ messages in thread
From: Shaohua Li @ 2016-08-30 17:29 UTC (permalink / raw)
  To: linux-raid; +Cc: Kernel-team

If there aren't enough stripes, reshape will hang. We have a check for
this in new reshape, but miss it for reshape resume, hence we could see
hang in reshape resume. This patch forces enough stripes existed if
reshape resumes.

Signed-off-by: Shaohua Li <shli@fb.com>
---
 drivers/md/raid5.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 62febe8..2fdb97b 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -6639,6 +6639,16 @@ static struct r5conf *setup_conf(struct mddev *mddev)
 	}
 
 	conf->min_nr_stripes = NR_STRIPES;
+	if (mddev->reshape_position != MaxSector) {
+		int stripes = max_t(int,
+			((mddev->chunk_sectors << 9) / STRIPE_SIZE) * 4,
+			((mddev->new_chunk_sectors << 9) / STRIPE_SIZE) * 4);
+		conf->min_nr_stripes = max(NR_STRIPES, stripes);
+		if (conf->min_nr_stripes != NR_STRIPES)
+			printk(KERN_INFO
+				"md/raid:%s: force stripe size %d for reshape\n",
+				mdname(mddev), conf->min_nr_stripes);
+	}
 	memory = conf->min_nr_stripes * (sizeof(struct stripe_head) +
 		 max_disks * ((sizeof(struct bio) + PAGE_SIZE))) / 1024;
 	atomic_set(&conf->empty_inactive_list_nr, NR_STRIPE_HASH_LOCKS);
-- 
2.8.0.rc2


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

* Re: [PATCH] raid5: guarantee enough stripes to avoid reshape hang
  2016-08-30 17:29 [PATCH] raid5: guarantee enough stripes to avoid reshape hang Shaohua Li
@ 2016-08-31  8:05 ` NeilBrown
  0 siblings, 0 replies; 2+ messages in thread
From: NeilBrown @ 2016-08-31  8:05 UTC (permalink / raw)
  To: Shaohua Li, linux-raid; +Cc: Kernel-team

[-- Attachment #1: Type: text/plain, Size: 1713 bytes --]

On Wed, Aug 31 2016, Shaohua Li wrote:

> If there aren't enough stripes, reshape will hang. We have a check for
> this in new reshape, but miss it for reshape resume, hence we could see
> hang in reshape resume. This patch forces enough stripes existed if
> reshape resumes.
>
> Signed-off-by: Shaohua Li <shli@fb.com>

I'm really surprised that this was missing, but it certainly appears
that it was.

 Reviewed-by: NeilBrown <neilb@suse.com>

thanks!


NeilBrown


> ---
>  drivers/md/raid5.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index 62febe8..2fdb97b 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -6639,6 +6639,16 @@ static struct r5conf *setup_conf(struct mddev *mddev)
>  	}
>  
>  	conf->min_nr_stripes = NR_STRIPES;
> +	if (mddev->reshape_position != MaxSector) {
> +		int stripes = max_t(int,
> +			((mddev->chunk_sectors << 9) / STRIPE_SIZE) * 4,
> +			((mddev->new_chunk_sectors << 9) / STRIPE_SIZE) * 4);
> +		conf->min_nr_stripes = max(NR_STRIPES, stripes);
> +		if (conf->min_nr_stripes != NR_STRIPES)
> +			printk(KERN_INFO
> +				"md/raid:%s: force stripe size %d for reshape\n",
> +				mdname(mddev), conf->min_nr_stripes);
> +	}
>  	memory = conf->min_nr_stripes * (sizeof(struct stripe_head) +
>  		 max_disks * ((sizeof(struct bio) + PAGE_SIZE))) / 1024;
>  	atomic_set(&conf->empty_inactive_list_nr, NR_STRIPE_HASH_LOCKS);
> -- 
> 2.8.0.rc2
>
> --
> 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

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

end of thread, other threads:[~2016-08-31  8:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-30 17:29 [PATCH] raid5: guarantee enough stripes to avoid reshape hang Shaohua Li
2016-08-31  8:05 ` NeilBrown

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