From: "Darrick J. Wong" <djwong@kernel.org>
To: "Nirjhar Roy (IBM)" <nirjhar.roy.lists@gmail.com>
Cc: linux-xfs@vger.kernel.org, ritesh.list@gmail.com,
ojaswin@linux.ibm.com, hch@infradead.org
Subject: Re: [PATCH v1 1/2] xfs: Move ASSERTion location in xfs_rtcopy_summary()
Date: Wed, 28 Jan 2026 08:13:24 -0800 [thread overview]
Message-ID: <20260128161324.GU5945@frogsfrogsfrogs> (raw)
In-Reply-To: <a904c5bcb5b4fc2c7c2429646251a7f429a67d5a.1769613182.git.nirjhar.roy.lists@gmail.com>
On Wed, Jan 28, 2026 at 08:44:34PM +0530, Nirjhar Roy (IBM) wrote:
> We should ASSERT on a variable before using it, so that we
> don't end up using an illegal value.
>
> Signed-off-by: Nirjhar Roy (IBM) <nirjhar.roy.lists@gmail.com>
> ---
> fs/xfs/xfs_rtalloc.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
> index a12ffed12391..9fb975171bf8 100644
> --- a/fs/xfs/xfs_rtalloc.c
> +++ b/fs/xfs/xfs_rtalloc.c
> @@ -112,6 +112,11 @@ xfs_rtcopy_summary(
> error = xfs_rtget_summary(oargs, log, bbno, &sum);
> if (error)
> goto out;
> + if (sum < 0) {
> + ASSERT(sum >= 0);
> + error = -EFSCORRUPTED;
> + goto out;
Thanks for making this a bailout case,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> + }
> if (sum == 0)
> continue;
> error = xfs_rtmodify_summary(oargs, log, bbno, -sum);
> @@ -120,7 +125,6 @@ xfs_rtcopy_summary(
> error = xfs_rtmodify_summary(nargs, log, bbno, sum);
> if (error)
> goto out;
> - ASSERT(sum > 0);
> }
> }
> error = 0;
> --
> 2.43.5
>
>
next prev parent reply other threads:[~2026-01-28 16:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-28 15:14 [PATCH v1 0/2] Misc fixes in XFS realtime Nirjhar Roy (IBM)
2026-01-28 15:14 ` [PATCH v1 1/2] xfs: Move ASSERTion location in xfs_rtcopy_summary() Nirjhar Roy (IBM)
2026-01-28 15:25 ` Alan Huang
2026-01-28 16:14 ` Darrick J. Wong
2026-01-28 16:13 ` Darrick J. Wong [this message]
2026-01-28 17:00 ` Nirjhar Roy (IBM)
2026-01-28 15:14 ` [PATCH v1 2/2] xfs: Fix in xfs_rtalloc_query_range() Nirjhar Roy (IBM)
2026-01-28 17:14 ` Darrick J. Wong
2026-01-28 18:00 ` Nirjhar Roy (IBM)
2026-01-28 18:29 ` Darrick J. Wong
2026-01-28 18:30 ` Nirjhar Roy (IBM)
2026-02-02 6:25 ` Christoph Hellwig
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=20260128161324.GU5945@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=hch@infradead.org \
--cc=linux-xfs@vger.kernel.org \
--cc=nirjhar.roy.lists@gmail.com \
--cc=ojaswin@linux.ibm.com \
--cc=ritesh.list@gmail.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