linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: Kevin Vigor <kvigor@gmail.com>, linux-raid@vger.kernel.org
Cc: Kevin Vigor <kvigor@gmail.com>
Subject: Re: [PATCH 1/2] md/raid10: wake pending freeze in raid10d()
Date: Mon, 18 Jan 2021 11:59:43 +1100	[thread overview]
Message-ID: <87bldnjc00.fsf@notabene.neil.brown.name> (raw)
In-Reply-To: <20201231173000.3596606-1-kvigor@gmail.com>

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

On Thu, Dec 31 2020, Kevin Vigor wrote:

> The freeze_array() function waits for changes to nr_queued,
> but the raid10d() function alters it without sending a wake.
>
> This can lead to freeze_array() never being woken.

No it cannot.
freeze_array() is only called from handle_read_error() which is only
called from raid10d().  So it cannot possibly be sleeping at the point
where you added the wake_up().
handle_read_error() passes '1' as the 'extra' arg to freeze_array()
which exactly compensates for the recent decrement of ->nr_queued.

NAK.

Thanks,
NeilBrown


>
> Signed-off-by: Kevin Vigor <kvigor@gmail.com>
> ---
>  drivers/md/raid10.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
> index c5d88ef6a45c..f98df9f084c2 100644
> --- a/drivers/md/raid10.c
> +++ b/drivers/md/raid10.c
> @@ -2698,6 +2698,7 @@ static void raid10d(struct md_thread *thread)
>  	struct r10conf *conf = mddev->private;
>  	struct list_head *head = &conf->retry_list;
>  	struct blk_plug plug;
> +	int dequeued = 0;
>  
>  	md_check_recovery(mddev);
>  
> @@ -2709,6 +2710,7 @@ static void raid10d(struct md_thread *thread)
>  			while (!list_empty(&conf->bio_end_io_list)) {
>  				list_move(conf->bio_end_io_list.prev, &tmp);
>  				conf->nr_queued--;
> +				dequeued++;
>  			}
>  		}
>  		spin_unlock_irqrestore(&conf->device_lock, flags);
> @@ -2739,6 +2741,7 @@ static void raid10d(struct md_thread *thread)
>  		r10_bio = list_entry(head->prev, struct r10bio, retry_list);
>  		list_del(head->prev);
>  		conf->nr_queued--;
> +		dequeued++;
>  		spin_unlock_irqrestore(&conf->device_lock, flags);
>  
>  		mddev = r10_bio->mddev;
> @@ -2762,6 +2765,10 @@ static void raid10d(struct md_thread *thread)
>  			md_check_recovery(mddev);
>  	}
>  	blk_finish_plug(&plug);
> +
> +	/* in case freeze_array is waiting for changes to nr_queued. */
> +	if (conf->array_freeze_pending && dequeued)
> +		wake_up(&conf->wait_barrier);
>  }
>  
>  static int init_resync(struct r10conf *conf)
> -- 
> 2.26.2

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

      parent reply	other threads:[~2021-01-18  1:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-31 17:30 [PATCH 1/2] md/raid10: wake pending freeze in raid10d() Kevin Vigor
2020-12-31 17:30 ` [PATCH 2/2] md/raid10: introducing range-based barriers Kevin Vigor
2021-01-18  0:59 ` NeilBrown [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=87bldnjc00.fsf@notabene.neil.brown.name \
    --to=neilb@suse.de \
    --cc=kvigor@gmail.com \
    --cc=linux-raid@vger.kernel.org \
    /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).