Linux XFS filesystem development
 help / color / mirror / Atom feed
From: Hans Holmberg <Hans.Holmberg@wdc.com>
To: hch <hch@lst.de>, Carlos Maiolino <cem@kernel.org>
Cc: "Darrick J. Wong" <djwong@kernel.org>,
	Dan Carpenter <dan.carpenter@linaro.org>,
	"linux-xfs@vger.kernel.org" <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH 3/3] xfs: don't wake zone space waiters without m_zone_info
Date: Mon, 17 Mar 2025 14:46:00 +0000	[thread overview]
Message-ID: <524d0aa3-2b70-438b-8188-27d5f12fce10@wdc.com> (raw)
In-Reply-To: <20250317054512.1131950-4-hch@lst.de>

On 17/03/2025 06:45, Christoph Hellwig wrote:
> From: "Darrick J. Wong" <djwong@kernel.org>
> 
> xfs_zoned_wake_all checks SB_ACTIVE to make sure it does the right thing
> when a shutdown happens during unmount, but it fails to account for the
> log recovery special case that sets SB_ACTIVE temporarily.  Add a NULL
> check to cover both cases.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> [hch: added a commit log and comment]
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  fs/xfs/xfs_zone_alloc.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/xfs/xfs_zone_alloc.c b/fs/xfs/xfs_zone_alloc.c
> index fd4c60a050e6..52af234936a2 100644
> --- a/fs/xfs/xfs_zone_alloc.c
> +++ b/fs/xfs/xfs_zone_alloc.c
> @@ -853,13 +853,22 @@ xfs_zone_alloc_and_submit(
>  	bio_io_error(&ioend->io_bio);
>  }
>  
> +/*
> + * Wake up all threads waiting for a zoned space allocation when the file system
> + * is shut down.
> + */
>  void
>  xfs_zoned_wake_all(
>  	struct xfs_mount	*mp)
>  {
> -	if (!(mp->m_super->s_flags & SB_ACTIVE))
> -		return; /* can happen during log recovery */
> -	wake_up_all(&mp->m_zone_info->zi_zone_wait);
> +	/*
> +	 * Don't wake up if there is no m_zone_info.  This is complicated by the
> +	 * fact that unmount can't atomically clear m_zone_info and thus we need
> +	 * to check SB_ACTIVE for that, but mount temporarily enables SB_ACTIVE
> +	 * during log recovery so we can't entirely rely on that either.
> +	 */
> +	if ((mp->m_super->s_flags & SB_ACTIVE) && mp->m_zone_info)
> +		wake_up_all(&mp->m_zone_info->zi_zone_wait);
>  }
>  
>  /*

Looks good,

Reviewed-by: Hans Holmberg <hans.holmberg@wdc.com>



  reply	other threads:[~2025-03-17 14:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-17  5:44 zoned fixes Christoph Hellwig
2025-03-17  5:44 ` [PATCH 1/3] xfs: fix a missing unlock in xfs_growfs_data Christoph Hellwig
2025-03-18 11:54   ` Carlos Maiolino
2025-03-24  8:52   ` Carlos Maiolino
2025-03-17  5:44 ` [PATCH 2/3] xfs: don't increment m_generation for all errors " Christoph Hellwig
2025-03-18 12:01   ` Carlos Maiolino
2025-03-17  5:44 ` [PATCH 3/3] xfs: don't wake zone space waiters without m_zone_info Christoph Hellwig
2025-03-17 14:46   ` Hans Holmberg [this message]
2025-03-18 12:04   ` Carlos Maiolino

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=524d0aa3-2b70-438b-8188-27d5f12fce10@wdc.com \
    --to=hans.holmberg@wdc.com \
    --cc=cem@kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=djwong@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-xfs@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