From: "Nirjhar Roy (IBM)" <nirjhar.roy.lists@gmail.com>
To: "Darrick J. Wong" <djwong@kernel.org>
Cc: hch@infradead.org, cem@kernel.org, linux-xfs@vger.kernel.org,
ritesh.list@gmail.com, ojaswin@linux.ibm.com
Subject: Re: [patch v3 1/2] xfs: Move ASSERTion location in xfs_rtcopy_summary()
Date: Tue, 3 Feb 2026 21:11:53 +0530 [thread overview]
Message-ID: <d4941ed2-fa57-4f17-a0bb-afa4ce6d610e@gmail.com> (raw)
In-Reply-To: <20260203153349.GM7712@frogsfrogsfrogs>
On 2/3/26 21:03, Darrick J. Wong wrote:
> On Tue, Feb 03, 2026 at 08:24:28PM +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..727582b98b27 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) {
> Oh, heh. I never replied to your question about XFS_IS_CORRUPT.
> That's the macro helper to report metadata corruptions that aren't
> caught by the verifiers (e.g. you expected a nonzero summary counter,
> but it was zero) because verifiers only look for discrepancies within a
> block.
Okay, thank you for the explanation.
>
> IOWs, this would be fine:
>
> if (XFS_IS_CORRUPT(oargs->mp, sum < 0)) {
> error = -EFSCORRUPTED;
> goto out;
> }
>
> --D
Okay, thank you. I can make the change.
--NR
>
>> + ASSERT(0);
>> + error = -EFSCORRUPTED;
>> + goto out;
>> + }
>> 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
>>
>>
--
Nirjhar Roy
Linux Kernel Developer
IBM, Bangalore
next prev parent reply other threads:[~2026-02-03 15:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-03 14:54 [patch v3 0/2] Misc fixes in XFS realtime Nirjhar Roy (IBM)
2026-02-03 14:54 ` [patch v3 1/2] xfs: Move ASSERTion location in xfs_rtcopy_summary() Nirjhar Roy (IBM)
2026-02-03 15:33 ` Darrick J. Wong
2026-02-03 15:41 ` Nirjhar Roy (IBM) [this message]
2026-02-03 14:54 ` [patch v3 2/2] xfs: Fix in xfs_rtalloc_query_range() Nirjhar Roy (IBM)
2026-02-03 15:34 ` Darrick J. Wong
2026-02-03 15:43 ` Nirjhar Roy (IBM)
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=d4941ed2-fa57-4f17-a0bb-afa4ce6d610e@gmail.com \
--to=nirjhar.roy.lists@gmail.com \
--cc=cem@kernel.org \
--cc=djwong@kernel.org \
--cc=hch@infradead.org \
--cc=linux-xfs@vger.kernel.org \
--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