Linux XFS filesystem development
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Aditya Srivastava <aditya.ansh182@gmail.com>
Cc: Carlos Maiolino <cem@kernel.org>,
	linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] xfs: prevent close() from hanging on frozen filesystems
Date: Wed, 10 Jun 2026 06:28:23 -0700	[thread overview]
Message-ID: <ailmd8JNOT62E6vD@infradead.org> (raw)
In-Reply-To: <20260610131341.1733-1-aditya.ansh182@gmail.com>

On Wed, Jun 10, 2026 at 01:13:41PM +0000, Aditya Srivastava wrote:
> A simple C reproducer demonstrating the hang (compile with -pthread):

Can you contribute this under the GPL or a compatible license, and
maybe even wire it up to xfstests?

> +	/*
> +	 * If the filesystem is frozen or freezing, don't trigger transactions
> +	 * that would block close() indefinitely. Background block garbage
> +	 * collection will clean up these speculative preallocations once
> +	 * the filesystem thaws.
> +	 */
> +	if (!xfs_fs_writable(mp, SB_FREEZE_WRITE))
> +		return 0;

Note that this is still racy as the freeze could come in right after
this check.  Basically what we'd need to fix this properly is a flag
to xfs_trans_alloc that uses sb_start_intwrite_trylock when set, and
returns a suitable error case in that case, which we'd then use to
unwind safely from release.


  reply	other threads:[~2026-06-10 13:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-10 13:13 [PATCH] xfs: prevent close() from hanging on frozen filesystems Aditya Srivastava
2026-06-10 13:28 ` Christoph Hellwig [this message]
2026-06-11 18:05   ` [PATCH v2] " Aditya Srivastava
2026-06-12  5:50     ` Christoph Hellwig
2026-06-12 11:07       ` Aditya Prakash Srivastava

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=ailmd8JNOT62E6vD@infradead.org \
    --to=hch@infradead.org \
    --cc=aditya.ansh182@gmail.com \
    --cc=cem@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --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