Linux XFS filesystem development
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Carlos Maiolino <cem@kernel.org>
Cc: linux-xfs@vger.kernel.org, Hans Holmberg <Hans.Holmberg@wdc.com>,
	Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Subject: [PATCH 1/4] xfs: check for shutdown before going to sleep in xfs_select_zone
Date: Thu,  5 Jun 2025 08:16:27 +0200	[thread overview]
Message-ID: <20250605061638.993152-2-hch@lst.de> (raw)
In-Reply-To: <20250605061638.993152-1-hch@lst.de>

Ensure the file system hasn't been shut down before waiting for a free
zone to become available, because that won't happen on a shut down
file system.  Without this processes can occasionally get stuck in
the allocator wait loop when racing with a file system shutdown.
This sporadically happens when running generic/388 or generic/475.

Fixes: 4e4d52075577 ("xfs: add the zoned space allocator")
Reported-by: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/xfs/xfs_zone_alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_zone_alloc.c b/fs/xfs/xfs_zone_alloc.c
index 80add26c0111..0de6f64b3169 100644
--- a/fs/xfs/xfs_zone_alloc.c
+++ b/fs/xfs/xfs_zone_alloc.c
@@ -727,7 +727,7 @@ xfs_select_zone(
 	for (;;) {
 		prepare_to_wait(&zi->zi_zone_wait, &wait, TASK_UNINTERRUPTIBLE);
 		oz = xfs_select_zone_nowait(mp, write_hint, pack_tight);
-		if (oz)
+		if (oz || xfs_is_shutdown(mp))
 			break;
 		schedule();
 	}
-- 
2.47.2


  reply	other threads:[~2025-06-05  6:16 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-05  6:16 misc fixes Christoph Hellwig
2025-06-05  6:16 ` Christoph Hellwig [this message]
2025-06-05  6:42   ` [PATCH 1/4] xfs: check for shutdown before going to sleep in xfs_select_zone Shinichiro Kawasaki
2025-06-05 12:02   ` Hans Holmberg
2025-06-05  6:16 ` [PATCH 2/4] xfs: remove NULL pointer checks in xfs_mru_cache_insert Christoph Hellwig
2025-06-05 12:04   ` Hans Holmberg
2025-06-05  6:16 ` [PATCH 3/4] xfs: use xfs_readonly_buftarg in xfs_remount_rw Christoph Hellwig
2025-06-05  7:24   ` John Garry
2025-06-05 12:05   ` Hans Holmberg
2025-06-05  6:16 ` [PATCH 4/4] xfs: move xfs_submit_zoned_bio a bit Christoph Hellwig
2025-06-05 12:07   ` Hans Holmberg
2025-06-16  8:02   ` Carlos Maiolino
2025-06-16 12:31 ` misc fixes 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=20250605061638.993152-2-hch@lst.de \
    --to=hch@lst.de \
    --cc=Hans.Holmberg@wdc.com \
    --cc=cem@kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=shinichiro.kawasaki@wdc.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