From: John Garry <john.garry@linux.dev>
To: linux-xfs@vger.kernel.org, Dave Chinner <dgc@kernel.org>
Subject: Re: [PATCH] xfs: do not let tr_atomic_ioend raise the minimum log size
Date: Mon, 16 Nov 2026 08:54:27 +0000 [thread overview]
Message-ID: <260c0d7d-39cb-40ca-9a49-2ae8a3531676@linux.dev> (raw)
In-Reply-To: <20261113043055.2578595-1-hengyul@cs.unc.edu>
On 11/13/26 04:30, Hengyu Liang wrote:
> Commit b1e09178b73a ("xfs: commit CoW-based atomic writes atomically")
> added the tr_atomic_ioend reservation and made
> xfs_log_calc_trans_resv_for_minlogblocks() copy it from the running
> filesystem.
>
> However, the copy has the current log count of tr_itruncate. On a
> filesystem with rmapbt and without reflink that count is 4, while the
> function puts the old count of 2 back for tr_itruncate itself. As of
> now, the minimum log size of such a filesystem is larger than the one
> its mkfs.xfs used, and the filesystem does not mount any more when its
> log has the old minimum size.
>
> The issue can be reproduced with mkfs.xfs from xfsprogs 5.13:
>
> truncate -s 512M xfs.img
> mkfs.xfs -m rmapbt=1,reflink=0 xfs.img
> mount -o loop xfs.img /mnt
>
> Before commit b1e09178b73a ("xfs: commit CoW-based atomic writes
> atomically"), the mount succeeds.
>
> After that commit, it fails with EINVAL:
>
> XFS (loop0): Log size 878 blocks too small, minimum size is 962 blocks
> XFS (loop0): AAIEEE! Log failed size checks. Abort!
>
> This patch will use the old log count for the copy as well. These
> filesystems have no reflink, so they never use this reservation.
>
> Fixes: b1e09178b73a ("xfs: commit CoW-based atomic writes atomically")
> Cc: stable@vger.kernel.org # v6.16
> Signed-off-by: Hengyu Liang <hengyul@cs.unc.edu>
> ---
> mkfs.xfs 4.9 to 5.13 give such a log to an rmapbt=1,reflink=0
> filesystem below 1 GiB, or up to 16 GiB with -d su=256k,sw=4.
>
> Application impact (Ubuntu 26.04 user space): udisks2 2.10.91 is asked
> to mount a filesystem made as above ("udisksctl mount -b /dev/vda"). On
> v6.15, it mounts it at /run/media/root/STICK513. On v6.16, it fails
> with "Error mounting /dev/vda ... wrong fs type, bad option, bad
> superblock".
>
> Tested on xfs for-next with 45 images made by mkfs.xfs 4.9 to 6.6: 26
> do not mount without this patch, all mount with it, and the largest
> reservation is the same as on v6.15.
>
> fs/xfs/libxfs/xfs_log_rlimit.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/xfs/libxfs/xfs_log_rlimit.c b/fs/xfs/libxfs/xfs_log_rlimit.c
> index 37712b2f8757..9454c91e9fb3 100644
> --- a/fs/xfs/libxfs/xfs_log_rlimit.c
> +++ b/fs/xfs/libxfs/xfs_log_rlimit.c
> @@ -128,6 +128,8 @@ xfs_log_calc_trans_resv_for_minlogblocks(
> resv->tr_write.tr_logcount = XFS_WRITE_LOG_COUNT;
> resv->tr_itruncate.tr_logcount = XFS_ITRUNCATE_LOG_COUNT;
> resv->tr_qm_dqalloc.tr_logcount = XFS_WRITE_LOG_COUNT;
> + /* tr_atomic_ioend starts as a copy of tr_itruncate. */
> + resv->tr_atomic_ioend.tr_logcount = XFS_ITRUNCATE_LOG_COUNT;
I have to admit that I am not really familiar with this log code.
Darrick was, but unfortunately he is no involved. The change looks sane,
even though we are partially overwriting resv->tr_atomic_ioend (from
when it is set earlier in the same function). Dave Chinner may be able
to kindly help review.
Thanks,
John
next prev parent reply other threads:[~2026-11-16 8:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-13 4:30 [PATCH] xfs: do not let tr_atomic_ioend raise the minimum log size Hengyu Liang
2026-11-16 8:54 ` John Garry [this message]
2026-11-16 20:24 ` Dave Chinner
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=260c0d7d-39cb-40ca-9a49-2ae8a3531676@linux.dev \
--to=john.garry@linux.dev \
--cc=dgc@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