From: "Darrick J. Wong" <djwong@kernel.org>
To: Weiming Shi <bestswngs@gmail.com>
Cc: linux-xfs@vger.kernel.org, Carlos Maiolino <cem@kernel.org>,
Brian Foster <bfoster@redhat.com>,
Christoph Hellwig <hch@infradead.org>, Xiang Mei <xmei5@asu.edu>
Subject: Re: [PATCH v2 2/3] xfs: splice unsorted log items back to the transaction after the loop
Date: Wed, 1 Jul 2026 14:43:54 -0700 [thread overview]
Message-ID: <20260701214354.GH6526@frogsfrogsfrogs> (raw)
In-Reply-To: <20260701153833.3155514-4-bestswngs@gmail.com>
On Wed, Jul 01, 2026 at 08:38:32AM -0700, Weiming Shi wrote:
> On error, xlog_recover_reorder_trans() splices the leftover sort_list
> items back to trans->r_itemq inside the loop before breaking out. The
> loop tail already splices the per-fate lists back, so do sort_list there
> too, guarded by the assert that used to sit after the loop.
>
> No functional change. It drops the duplicated splice so the next patch
> can add another error case without repeating it.
>
> Signed-off-by: Weiming Shi <bestswngs@gmail.com>
> ---
> fs/xfs/xfs_log_recover.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
> index a1b373c68f0e..5347f6a5ec42 100644
> --- a/fs/xfs/xfs_log_recover.c
> +++ b/fs/xfs/xfs_log_recover.c
> @@ -1912,12 +1912,6 @@ xlog_recover_reorder_trans(
> xfs_warn(log->l_mp,
> "%s: unrecognized type of log operation (%d)",
> __func__, ITEM_TYPE(item));
> - /*
> - * return the remaining items back to the transaction
> - * item list so they can be freed in caller.
> - */
> - if (!list_empty(&sort_list))
> - list_splice_init(&sort_list, &trans->r_itemq);
> error = -EFSCORRUPTED;
> break;
> }
> @@ -1945,7 +1939,15 @@ xlog_recover_reorder_trans(
> }
> }
>
> - ASSERT(list_empty(&sort_list));
> + /*
> + * Return the remaining items back to the transaction item list so they
> + * can be freed in caller. This should only happen when we encountered
s/encountered/encounter/
(same verb tense across a sentence)
> + * an error.
> + */
> + if (!list_empty(&sort_list)) {
> + ASSERT(error);
This otherwise looks fine to me.
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> + list_splice_init(&sort_list, &trans->r_itemq);
> + }
> if (!list_empty(&buffer_list))
> list_splice(&buffer_list, &trans->r_itemq);
> if (!list_empty(&item_list))
> --
> 2.43.0
>
>
next prev parent reply other threads:[~2026-07-01 21:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 15:38 [PATCH v2 0/3] xfs: fix NULL deref in log recovery reorder Weiming Shi
2026-07-01 15:38 ` [PATCH v2 1/3] xfs: drop ASSERT(0) on unrecognized log item type Weiming Shi
2026-07-01 21:41 ` Darrick J. Wong
2026-07-02 10:54 ` Christoph Hellwig
2026-07-01 15:38 ` [PATCH v2 2/3] xfs: splice unsorted log items back to the transaction after the loop Weiming Shi
2026-07-01 21:43 ` Darrick J. Wong [this message]
2026-07-02 10:55 ` Christoph Hellwig
2026-07-01 15:38 ` [PATCH v2 3/3] xfs: fail recovery on a committed log item with no regions Weiming Shi
2026-07-01 22:08 ` Darrick J. Wong
2026-07-02 10:56 ` Christoph Hellwig
2026-07-02 15:32 ` Darrick J. Wong
2026-07-02 16:13 ` Weiming Shi
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=20260701214354.GH6526@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=bestswngs@gmail.com \
--cc=bfoster@redhat.com \
--cc=cem@kernel.org \
--cc=hch@infradead.org \
--cc=linux-xfs@vger.kernel.org \
--cc=xmei5@asu.edu \
/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