linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Neil Brown <neilb@suse.de>
To: Jes.Sorensen@redhat.com
Cc: linux-raid@vger.kernel.org, nate.dailey@stratus.com
Subject: Re: [PATCH 1/1] md/raid1: Avoid raid1 resync getting stuck
Date: Wed, 23 Sep 2015 16:49:57 +1000	[thread overview]
Message-ID: <871tdpy6i2.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <1442413205-9593-2-git-send-email-Jes.Sorensen@redhat.com>

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

Jes.Sorensen@redhat.com writes:

> From: Jes Sorensen <Jes.Sorensen@redhat.com>
>
> close_sync() needs to set conf->next_resync to a large, but safe value
> below MaxSector and use it to determine whether or not to set
> start_next_window in wait_barrier()
>
> Solution suggested by Neil Brown.
>
> Reported-by: Nate Dailey <nate.dailey@stratus.com>
> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
> ---
>  drivers/md/raid1.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
> index 4517f06..763a0a8 100644
> --- a/drivers/md/raid1.c
> +++ b/drivers/md/raid1.c
> @@ -881,8 +881,7 @@ static sector_t wait_barrier(struct r1conf *conf, struct bio *bio)
>  	}
>  
>  	if (bio && bio_data_dir(bio) == WRITE) {
> -		if (bio->bi_iter.bi_sector >=
> -		    conf->mddev->curr_resync_completed) {
> +		if (bio->bi_iter.bi_sector >= conf->next_resync) {
>  			if (conf->start_next_window == MaxSector)
>  				conf->start_next_window =
>  					conf->next_resync +
> @@ -1516,7 +1515,7 @@ static void close_sync(struct r1conf *conf)
>  	conf->r1buf_pool = NULL;
>  
>  	spin_lock_irq(&conf->resync_lock);
> -	conf->next_resync = 0;
> +	conf->next_resync = MaxSector - 2 * NEXT_NORMALIO_DISTANCE;
>  	conf->start_next_window = MaxSector;
>  	conf->current_window_requests +=
>  		conf->next_window_requests;
> -- 
> 2.4.3
Applied, thanks.

NeilBrown

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

      reply	other threads:[~2015-09-23  6:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-16 14:20 [PATCH 0/1] Fix raid1 resync getting stuck Jes.Sorensen
2015-09-16 14:20 ` [PATCH 1/1] md/raid1: Avoid " Jes.Sorensen
2015-09-23  6:49   ` Neil Brown [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871tdpy6i2.fsf@notabene.neil.brown.name \
    --to=neilb@suse.de \
    --cc=Jes.Sorensen@redhat.com \
    --cc=linux-raid@vger.kernel.org \
    --cc=nate.dailey@stratus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).