From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 2/2] xfs: estimate post-merge refcounts correctly
Date: Wed, 30 Nov 2022 09:37:08 +1100 [thread overview]
Message-ID: <20221129223708.GK3600936@dread.disaster.area> (raw)
In-Reply-To: <166975929675.3768925.10238207487640742011.stgit@magnolia>
On Tue, Nov 29, 2022 at 02:01:36PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> Upon enabling fsdax + reflink for XFS, xfs/179 began to report refcount
> metadata corruptions after being run. Specifically, xfs_repair noticed
> single-block refcount records that could be combined but had not been.
>
> The root cause of this is improper MAXREFCOUNT edge case handling in
> xfs_refcount_merge_extents. When we're trying to find candidates for a
> refcount btree record merge, we compute the refcount attribute of the
> merged record, but we fail to account for the fact that once a record
> hits rc_refcount == MAXREFCOUNT, it is pinned that way forever. Hence
> the computed refcount is wrong, and we fail to merge the extents.
>
> Fix this by adjusting the merge predicates to compute the adjusted
> refcount correctly.
>
> Fixes: 3172725814f9 ("xfs: adjust refcount of an extent of blocks in refcount btree")
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
> fs/xfs/libxfs/xfs_refcount.c | 25 +++++++++++++++++++++----
> 1 file changed, 21 insertions(+), 4 deletions(-)
Looks good to me.
Reviewed-by: Dave Chinner <dchinner@redhat.com>
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2022-11-29 22:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-29 22:01 [PATCHSET 0/2] xfs: fix broken MAXREFCOUNT handling Darrick J. Wong
2022-11-29 22:01 ` [PATCH 1/2] xfs: hoist refcount record merge predicates Darrick J. Wong
2022-11-29 22:35 ` Dave Chinner
2022-11-30 0:13 ` Darrick J. Wong
2022-11-30 9:24 ` Yang, Xiao/杨 晓
2022-11-29 22:01 ` [PATCH 2/2] xfs: estimate post-merge refcounts correctly Darrick J. Wong
2022-11-29 22:37 ` Dave Chinner [this message]
2022-11-30 9:32 ` Yang, Xiao/杨 晓
2022-11-30 18:49 ` Darrick J. Wong
2022-11-29 22:06 ` [RFC PATCH] xfs/179: modify test to trigger refcount update bugs Darrick J. Wong
2022-11-29 22:42 ` Dave Chinner
2022-11-30 0:19 ` Darrick J. Wong
2022-11-30 10:07 ` Yang, Xiao/杨 晓
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=20221129223708.GK3600936@dread.disaster.area \
--to=david@fromorbit.com \
--cc=djwong@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.