Misc fixes in XFS realtime
v4 cover Misc fixes in XFS realtime
This patchset has 2 fixes in some XFS realtime code. Details are in the commit messages.
[v3] -> v4
1.Patch 1/2 -> Replaced the ASSERT with an XFS_IS_CORRUPT 2.Patch 2/2 -> Removed an extra line between tags
[v2] -> [v3]
1. Patch 1/2 -> Changed ASSERT(sum >= 0); to ASSERT(0); (as discussed in [3]) and removed RB from Darrick since the code was slightly changed after the RB was given.
2. Patch 2/2 -> Added RB from Carlos.
[v1] --> [v2]
1. Added RB from Darrick in patch 1/2.
2. Added Cc, Fixes tag and RB from Darrck in patch 2/2.
[3] - https://lore.kernel.org/all/20260202185348.GI7712@frogsfrogsfrogs/
[v3]- https://lore.kernel.org/all/[email protected]/
[v2]- https://lore.kernel.org/all/[email protected]/
[v1]- https://lore.kernel.org/all/[email protected]/
Nirjhar Roy (IBM) (2):
xfs: Replace ASSERT with XFS_IS_CORRUPT in xfs_rtcopy_summary()
xfs: Fix in xfs_rtalloc_query_range()
fs/xfs/libxfs/xfs_rtbitmap.c | 2 +- fs/xfs/xfs_rtalloc.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-)
Signature · 1 line
2.43.5
PATCH v4 1/2 xfs: Replace ASSERT with XFS_IS_CORRUPT in xfs_rtcopy_summary()
Replace ASSERT(sum > 0) with an XFS_IS_CORRUPT() and place it just after the call to xfs_rtget_summary() so that we don't end up using an illegal value of sum.
--- fs/xfs/xfs_rtalloc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/xfs/xfs_rtalloc.c +4 -1
@@ -112,6 +112,10 @@ xfs_rtcopy_summary( error =xfs_rtget_summary (oargs, log, bbno, &sum);if (error) goto out; +if (XFS_IS_CORRUPT (oargs->mp, sum <0 )) { + error = -EFSCORRUPTED ; + goto out; + }if (sum ==0 )continue ; error =xfs_rtmodify_summary (oargs, log, bbno, -sum);
@@ -120,7 +124,6 @@ xfs_rtcopy_summary( error =xfs_rtmodify_summary (nargs, log, bbno, sum);if (error) goto out; -ASSERT (sum >0 ); } } error =0 ;
Signature · 1 line
2.43.5
Re: [patch v4 1/2] xfs: Replace ASSERT with XFS_IS_CORRUPT in xfs_rtcopy_summary()
Quoted 5 lines · Nirjhar Roy (IBM)
Replace ASSERT(sum > 0) with an
XFS_IS_CORRUPT()and place it just after the call toxfs_rtget_summary()so that we don't end up using an illegal value of sum.Signed-off-by Nirjhar Roy (IBM) <[email protected]>
Looks good to me now, thanks for your persistence!
--D
Quoted 31 lines
--- fs/xfs/xfs_rtalloc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)fs/xfs/xfs_rtalloc.c +4
-1@@ -112,6 +112,10 @@ xfs_rtcopy_summary( error =xfs_rtget_summary (oargs, log, bbno, &sum);if (error) goto out; +if (XFS_IS_CORRUPT (oargs->mp, sum <0 )) { + error = -EFSCORRUPTED ; + goto out; + }if (sum ==0 )continue ; error =xfs_rtmodify_summary (oargs, log, bbno, -sum);@@ -120,7 +124,6 @@ xfs_rtcopy_summary( error =xfs_rtmodify_summary (nargs, log, bbno, sum);if (error) goto out; -ASSERT (sum >0 ); } } error =0 ;Signature · 1 line
2.43.5
Re: [patch v4 1/2] xfs: Replace ASSERT with XFS_IS_CORRUPT in xfs_rtcopy_summary()
Quoted 8 lines · Darrick J. Wong
Quoted 5 lines · Nirjhar Roy (IBM)
Replace ASSERT(sum > 0) with an
XFS_IS_CORRUPT()and place it just after the call toxfs_rtget_summary()so that we don't end up using an illegal value of sum.Signed-off-by Nirjhar Roy (IBM) <[email protected]>Looks good to me now, thanks for your persistence!
Reviewed-by "Darrick J. Wong" <[email protected]>
Thank you for your review comments.
--NR
Quoted 34 lines
--D
Quoted 31 lines
--- fs/xfs/xfs_rtalloc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)fs/xfs/xfs_rtalloc.c +4
-1@@ -112,6 +112,10 @@ xfs_rtcopy_summary( error =xfs_rtget_summary (oargs, log, bbno, &sum);if (error) goto out; +if (XFS_IS_CORRUPT (oargs->mp, sum <0 )) { + error = -EFSCORRUPTED ; + goto out; + }if (sum ==0 )continue ; error =xfs_rtmodify_summary (oargs, log, bbno, -sum);@@ -120,7 +124,6 @@ xfs_rtcopy_summary( error =xfs_rtmodify_summary (nargs, log, bbno, sum);if (error) goto out; -ASSERT (sum >0 ); } } error =0 ;Signature · 1 line
2.43.5
Signature · 3 lines
Nirjhar Roy Linux Kernel Developer IBM, Bangalore
Re: [patch v4 1/2] xfs: Replace ASSERT with XFS_IS_CORRUPT in xfs_rtcopy_summary()
In reply to Nirjhar Roy (IBM)Quoted 5 lines · Nirjhar Roy (IBM)
Replace ASSERT(sum > 0) with an
XFS_IS_CORRUPT()and place it just after the call toxfs_rtget_summary()so that we don't end up using an illegal value of sum.Signed-off-by Nirjhar Roy (IBM) <[email protected]>
Looks good to me know. Thanks for addressing the ugly ASSERT :)
Quoted 30 lines
--- fs/xfs/xfs_rtalloc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)fs/xfs/xfs_rtalloc.c +4
-1@@ -112,6 +112,10 @@ xfs_rtcopy_summary( error =xfs_rtget_summary (oargs, log, bbno, &sum);if (error) goto out; +if (XFS_IS_CORRUPT (oargs->mp, sum <0 )) { + error = -EFSCORRUPTED ; + goto out; + }if (sum ==0 )continue ; error =xfs_rtmodify_summary (oargs, log, bbno, -sum);@@ -120,7 +124,6 @@ xfs_rtcopy_summary( error =xfs_rtmodify_summary (nargs, log, bbno, sum);if (error) goto out; -ASSERT (sum >0 ); } } error =0 ;Signature · 1 line
2.43.5
Re: [patch v4 1/2] xfs: Replace ASSERT with XFS_IS_CORRUPT in xfs_rtcopy_summary()
Quoted 9 lines · Carlos Maiolino
Quoted 5 lines · Nirjhar Roy (IBM)
Replace ASSERT(sum > 0) with an
XFS_IS_CORRUPT()and place it just after the call toxfs_rtget_summary()so that we don't end up using an illegal value of sum.Signed-off-by Nirjhar Roy (IBM) <[email protected]>Looks good to me know. Thanks for addressing the ugly ASSERT :)
Reviewed-by Carlos Maiolino <[email protected]>
Thank you.
--NR
Quoted 31 lines
Quoted 31 lines
--- fs/xfs/xfs_rtalloc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)fs/xfs/xfs_rtalloc.c +4
-1@@ -112,6 +112,10 @@ xfs_rtcopy_summary( error =xfs_rtget_summary (oargs, log, bbno, &sum);if (error) goto out; +if (XFS_IS_CORRUPT (oargs->mp, sum <0 )) { + error = -EFSCORRUPTED ; + goto out; + }if (sum ==0 )continue ; error =xfs_rtmodify_summary (oargs, log, bbno, -sum);@@ -120,7 +124,6 @@ xfs_rtcopy_summary( error =xfs_rtmodify_summary (nargs, log, bbno, sum);if (error) goto out; -ASSERT (sum >0 ); } } error =0 ;Signature · 1 line
2.43.5
Signature · 3 lines
Nirjhar Roy Linux Kernel Developer IBM, Bangalore
PATCH v4 2/2 xfs: Fix in xfs_rtalloc_query_range()
In reply to Nirjhar Roy (IBM)xfs_rtalloc_query_range() should not return 0 by doing a NOP when start == end i.e, when the rtgroup size is 1. This causes incorrect calculation of free rtextents i.e, the count is reduced by 1 since the last rtgroup's rtextent count is not taken and hence xfs_scrub throws false summary counter report (from xchk_fscounters()).
A simple way to reproduce the above bug:
$ mkfs.xfs -f -m metadir=1 \
-r rtdev=/dev/loop2,extsize=4096,rgcount=4,size=1G \
-d size=1G /dev/loop1
meta-data=/dev/loop1 isize=512 agcount=4, agsize=65536 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=1
= reflink=0 bigtime=1 inobtcount=1 nrext64=1
= exchange=1 metadir=1
data = bsize=4096 blocks=262144, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1, parent=0
log =internal log bsize=4096 blocks=16384, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =/dev/loop2 extsz=4096 blocks=262144, rtextents=262144
= rgcount=4 rgsize=65536 extents
= zoned=0 start=0 reserved=0
Discarding blocks...Done.
Discarding blocks...Done.
$ mount -o rtdev=/dev/loop2 /dev/loop1 /mnt1/scratch
$ xfs_growfs -R $(( 65536 * 4 + 1 )) /mnt1/scratch
meta-data=/dev/loop1 isize=512 agcount=4, agsize=65536 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=1
= reflink=0 bigtime=1 inobtcount=1 nrext64=1
= exchange=1 metadir=1
data = bsize=4096 blocks=262144, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1, parent=0
log =internal log bsize=4096 blocks=16384, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =/dev/loop2 extsz=4096 blocks=262144, rtextents=262144
= rgcount=4 rgsize=65536 extents
= zoned=0 start=0 reserved=0
calling xfsctl with in.newblocks = 262145
realtime blocks changed from 262144 to 262145
$ xfs_scrub -n -v /mnt1/scratch
Phase 1: Find filesystem geometry.
/mnt1/scratch: using 2 threads to scrub.
Phase 2: Check internal metadata.
Corruption: rtgroup 4 realtime summary: Repairs are required.
Phase 3: Scan all inodes.
Phase 5: Check directory tree.
Info: /mnt1/scratch: Filesystem has errors, skipping connectivity checks.
Phase 7: Check summary counters.
Corruption: filesystem summary counters: Repairs are required.
125.0MiB data used; 8.0KiB realtime data used; 15 inodes used.
64.3MiB data found; 4.0KiB realtime data found; 18 inodes found.
18 inodes counted; 18 inodes checked.
Phase 8: Trim filesystem storage.
/mnt1/scratch: corruptions found: 2
/mnt1/scratch: Re-run xfs_scrub without -n.--- fs/xfs/libxfs/xfs_rtbitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/libxfs/xfs_rtbitmap.c +1 -1
@@ -1170,7 +1170,7 @@ xfs_rtalloc_query_range(if (start > end)return -EINVAL ; -if (start == end || start >= rtg->rtg_extents) +if (start >= rtg->rtg_extents)return 0 ; end =min (end, rtg->rtg_extents -1 );
Signature · 1 line
2.43.5
Carlos Maiolino
maintainerRe: [patch v4 2/2] xfs: Fix in xfs_rtalloc_query_range()
Quoted 5 lines · Nirjhar Roy (IBM)
xfs_rtalloc_query_range()should not return 0 by doing a NOP when start == end i.e, when the rtgroup size is 1. This causes incorrect calculation of free rtextents i.e, the count is reduced by 1 since the last rtgroup's rtextent count is not taken and hencexfs_scrubthrows false summary counter report (fromxchk_fscounters()).
This causes a regression in xfstests's generic/475 running on a RT device.
I'm dropping this patch until I have time to investigate what's wrong.
Quoted 81 lines
A simple way to reproduce the above bug:
$ mkfs.xfs -f -m metadir=1 \ -r rtdev=/dev/loop2,extsize=4096,rgcount=4,size=1G \ -d size=1G /dev/loop1 meta-data=/dev/loop1 isize=512 agcount=4, agsize=65536 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=1, rmapbt=1 = reflink=0 bigtime=1 inobtcount=1 nrext64=1 = exchange=1 metadir=1 data = bsize=4096 blocks=262144, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1, parent=0 log =internal log bsize=4096 blocks=16384, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =/dev/loop2 extsz=4096 blocks=262144, rtextents=262144 = rgcount=4 rgsize=65536 extents = zoned=0 start=0 reserved=0 Discarding blocks...Done. Discarding blocks...Done. $ mount -o rtdev=/dev/loop2 /dev/loop1 /mnt1/scratch $ xfs_growfs -R $(( 65536 * 4 + 1 )) /mnt1/scratch meta-data=/dev/loop1 isize=512 agcount=4, agsize=65536 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=1, rmapbt=1 = reflink=0 bigtime=1 inobtcount=1 nrext64=1 = exchange=1 metadir=1 data = bsize=4096 blocks=262144, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1, parent=0 log =internal log bsize=4096 blocks=16384, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =/dev/loop2 extsz=4096 blocks=262144, rtextents=262144 = rgcount=4 rgsize=65536 extents = zoned=0 start=0 reserved=0 calling xfsctl with in.newblocks = 262145 realtime blocks changed from 262144 to 262145 $ xfs_scrub -n -v /mnt1/scratch Phase 1: Find filesystem geometry. /mnt1/scratch: using 2 threads to scrub. Phase 2: Check internal metadata. Corruption: rtgroup 4 realtime summary: Repairs are required. Phase 3: Scan all inodes. Phase 5: Check directory tree. Info: /mnt1/scratch: Filesystem has errors, skipping connectivity checks. Phase 7: Check summary counters. Corruption: filesystem summary counters: Repairs are required. 125.0MiB data used; 8.0KiB realtime data used; 15 inodes used. 64.3MiB data found; 4.0KiB realtime data found; 18 inodes found. 18 inodes counted; 18 inodes checked. Phase 8: Trim filesystem storage. /mnt1/scratch: corruptions found: 2 /mnt1/scratch: Re-run xfs_scrub without -n.Cc <[email protected]> # v6.13Fixes e3088ae2dcae3c ("xfs: move RT bitmap and summary information to the rtgroup")Reviewed-by "Darrick J. Wong" <[email protected]>Reviewed-by Carlos Maiolino <[email protected]>Signed-off-by Nirjhar Roy (IBM) <[email protected]>--- fs/xfs/libxfs/xfs_rtbitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/xfs/libxfs/xfs_rtbitmap.c +1
-1@@ -1170,7 +1170,7 @@ xfs_rtalloc_query_range(if (start > end)return -EINVAL ; -if (start == end || start >= rtg->rtg_extents) +if (start >= rtg->rtg_extents)return 0 ; end =min (end, rtg->rtg_extents -1 );Signature · 1 line
2.43.5
Re: [patch v4 2/2] xfs: Fix in xfs_rtalloc_query_range()
Quoted 10 lines · Carlos Maiolino
Quoted 5 lines · Nirjhar Roy (IBM)
xfs_rtalloc_query_range()should not return 0 by doing a NOP when start == end i.e, when the rtgroup size is 1. This causes incorrect calculation of free rtextents i.e, the count is reduced by 1 since the last rtgroup's rtextent count is not taken and hencexfs_scrubthrows false summary counter report (fromxchk_fscounters()).This causes a regression in xfstests's generic/475 running on a RT device.
I'm dropping this patch until I have time to investigate what's wrong.
I just took a quick glance at generic/475 - It does something related to recovery. I am not sure how this fix is affecting this test. Maybe this fix is triggering some other bug which needs to be fixed. Can you please share the error logs and the local.config you used?
--NR
Quoted 81 lines
Quoted 81 lines
A simple way to reproduce the above bug:
$ mkfs.xfs -f -m metadir=1 \ -r rtdev=/dev/loop2,extsize=4096,rgcount=4,size=1G \ -d size=1G /dev/loop1 meta-data=/dev/loop1 isize=512 agcount=4, agsize=65536 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=1, rmapbt=1 = reflink=0 bigtime=1 inobtcount=1 nrext64=1 = exchange=1 metadir=1 data = bsize=4096 blocks=262144, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1, parent=0 log =internal log bsize=4096 blocks=16384, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =/dev/loop2 extsz=4096 blocks=262144, rtextents=262144 = rgcount=4 rgsize=65536 extents = zoned=0 start=0 reserved=0 Discarding blocks...Done. Discarding blocks...Done. $ mount -o rtdev=/dev/loop2 /dev/loop1 /mnt1/scratch $ xfs_growfs -R $(( 65536 * 4 + 1 )) /mnt1/scratch meta-data=/dev/loop1 isize=512 agcount=4, agsize=65536 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=1, rmapbt=1 = reflink=0 bigtime=1 inobtcount=1 nrext64=1 = exchange=1 metadir=1 data = bsize=4096 blocks=262144, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1, parent=0 log =internal log bsize=4096 blocks=16384, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =/dev/loop2 extsz=4096 blocks=262144, rtextents=262144 = rgcount=4 rgsize=65536 extents = zoned=0 start=0 reserved=0 calling xfsctl with in.newblocks = 262145 realtime blocks changed from 262144 to 262145 $ xfs_scrub -n -v /mnt1/scratch Phase 1: Find filesystem geometry. /mnt1/scratch: using 2 threads to scrub. Phase 2: Check internal metadata. Corruption: rtgroup 4 realtime summary: Repairs are required. Phase 3: Scan all inodes. Phase 5: Check directory tree. Info: /mnt1/scratch: Filesystem has errors, skipping connectivity checks. Phase 7: Check summary counters. Corruption: filesystem summary counters: Repairs are required. 125.0MiB data used; 8.0KiB realtime data used; 15 inodes used. 64.3MiB data found; 4.0KiB realtime data found; 18 inodes found. 18 inodes counted; 18 inodes checked. Phase 8: Trim filesystem storage. /mnt1/scratch: corruptions found: 2 /mnt1/scratch: Re-run xfs_scrub without -n.Cc <[email protected]> # v6.13Fixes e3088ae2dcae3c ("xfs: move RT bitmap and summary information to the rtgroup")Reviewed-by "Darrick J. Wong" <[email protected]>Reviewed-by Carlos Maiolino <[email protected]>Signed-off-by Nirjhar Roy (IBM) <[email protected]>--- fs/xfs/libxfs/xfs_rtbitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/xfs/libxfs/xfs_rtbitmap.c +1
-1@@ -1170,7 +1170,7 @@ xfs_rtalloc_query_range(if (start > end)return -EINVAL ; -if (start == end || start >= rtg->rtg_extents) +if (start >= rtg->rtg_extents)return 0 ; end =min (end, rtg->rtg_extents -1 );Signature · 1 line
2.43.5
Signature · 3 lines
Nirjhar Roy Linux Kernel Developer IBM, Bangalore
Carlos Maiolino
maintainerRe: [patch v4 2/2] xfs: Fix in xfs_rtalloc_query_range()
Quoted 11 lines · Nirjhar Roy (IBM)
Quoted 9 lines · Carlos Maiolino
Quoted 5 lines · Nirjhar Roy (IBM)
xfs_rtalloc_query_range()should not return 0 by doing a NOP when start == end i.e, when the rtgroup size is 1. This causes incorrect calculation of free rtextents i.e, the count is reduced by 1 since the last rtgroup's rtextent count is not taken and hencexfs_scrubthrows false summary counter report (fromxchk_fscounters()).This causes a regression in xfstests's generic/475 running on a RT device.
Quoted 7 lines
Quoted 1 line
I'm dropping this patch until I have time to investigate what's wrong.
I just took a quick glance at generic/475 - It does something related to recovery. I am not sure how this fix is affecting this test. Maybe this fix is triggering some other bug which needs to be fixed. Can you please share the error logs and the local.config you used?
I will get the info and let you know, I don't have access to my test system right now to get the details.
What config did you use? I'll give it a try later tonight and see if I spot any differences.
Quoted 87 lines
--NR
Quoted 79 lines
Quoted 79 lines
A simple way to reproduce the above bug:
$ mkfs.xfs -f -m metadir=1 \ -r rtdev=/dev/loop2,extsize=4096,rgcount=4,size=1G \ -d size=1G /dev/loop1 meta-data=/dev/loop1 isize=512 agcount=4, agsize=65536 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=1, rmapbt=1 = reflink=0 bigtime=1 inobtcount=1 nrext64=1 = exchange=1 metadir=1 data = bsize=4096 blocks=262144, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1, parent=0 log =internal log bsize=4096 blocks=16384, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =/dev/loop2 extsz=4096 blocks=262144, rtextents=262144 = rgcount=4 rgsize=65536 extents = zoned=0 start=0 reserved=0 Discarding blocks...Done. Discarding blocks...Done. $ mount -o rtdev=/dev/loop2 /dev/loop1 /mnt1/scratch $ xfs_growfs -R $(( 65536 * 4 + 1 )) /mnt1/scratch meta-data=/dev/loop1 isize=512 agcount=4, agsize=65536 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=1, rmapbt=1 = reflink=0 bigtime=1 inobtcount=1 nrext64=1 = exchange=1 metadir=1 data = bsize=4096 blocks=262144, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1, parent=0 log =internal log bsize=4096 blocks=16384, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =/dev/loop2 extsz=4096 blocks=262144, rtextents=262144 = rgcount=4 rgsize=65536 extents = zoned=0 start=0 reserved=0 calling xfsctl with in.newblocks = 262145 realtime blocks changed from 262144 to 262145 $ xfs_scrub -n -v /mnt1/scratch Phase 1: Find filesystem geometry. /mnt1/scratch: using 2 threads to scrub. Phase 2: Check internal metadata. Corruption: rtgroup 4 realtime summary: Repairs are required. Phase 3: Scan all inodes. Phase 5: Check directory tree. Info: /mnt1/scratch: Filesystem has errors, skipping connectivity checks. Phase 7: Check summary counters. Corruption: filesystem summary counters: Repairs are required. 125.0MiB data used; 8.0KiB realtime data used; 15 inodes used. 64.3MiB data found; 4.0KiB realtime data found; 18 inodes found. 18 inodes counted; 18 inodes checked. Phase 8: Trim filesystem storage. /mnt1/scratch: corruptions found: 2 /mnt1/scratch: Re-run xfs_scrub without -n.Cc <[email protected]> # v6.13Fixes e3088ae2dcae3c ("xfs: move RT bitmap and summary information to the rtgroup")Reviewed-by "Darrick J. Wong" <[email protected]>Reviewed-by Carlos Maiolino <[email protected]>Signed-off-by Nirjhar Roy (IBM) <[email protected]>--- fs/xfs/libxfs/xfs_rtbitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/xfs/libxfs/xfs_rtbitmap.c +1
-1@@ -1170,7 +1170,7 @@ xfs_rtalloc_query_range(if (start > end)return -EINVAL ; -if (start == end || start >= rtg->rtg_extents) +if (start >= rtg->rtg_extents)return 0 ; end =min (end, rtg->rtg_extents -1 );Signature · 1 line
2.43.5Signature · 3 lines
Nirjhar Roy Linux Kernel Developer IBM, Bangalore
Re: [patch v4 2/2] xfs: Fix in xfs_rtalloc_query_range()
Quoted 11 lines · Carlos Maiolino
Quoted 10 lines · Nirjhar Roy (IBM)
Quoted 9 lines · Carlos Maiolino
Quoted 5 lines · Nirjhar Roy (IBM)
xfs_rtalloc_query_range()should not return 0 by doing a NOP when start == end i.e, when the rtgroup size is 1. This causes incorrect calculation of free rtextents i.e, the count is reduced by 1 since the last rtgroup's rtextent count is not taken and hencexfs_scrubthrows false summary counter report (fromxchk_fscounters()).This causes a regression in xfstests's generic/475 running on a RT device.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
I'm dropping this patch until I have time to investigate what's wrong.
I just took a quick glance at generic/475 - It does something related to recovery. I am not sure how this fix is affecting this test. Maybe this fix is triggering some other bug which needs to be fixed. Can you please share the error logs and the local.config you used?
I will get the info and let you know, I don't have access to my test system right now to get the details.
Okay sure, thank you.
Quoted 3 lines
What config did you use? I'll give it a try later tonight and see if I spot any differences.
I haven't run it yet. But I usually use the following configuration
[xfs_4k]
export TEST_DEV=/dev/loop0
export TEST_DIR=/mnt1/test
export SCRATCH_DEV=/dev/loop1
export SCRATCH_MNT=/mnt1/scratch
export SCRATCH_RTDEV=/dev/loop2
export USE_EXTERNAL=yes
Most of the options are the default ones and/or used by the test script itself.
--NR
Quoted 87 lines
Quoted 87 lines
--NR
Quoted 78 lines
Quoted 78 lines
A simple way to reproduce the above bug:
$ mkfs.xfs -f -m metadir=1 \ -r rtdev=/dev/loop2,extsize=4096,rgcount=4,size=1G \ -d size=1G /dev/loop1 meta-data=/dev/loop1 isize=512 agcount=4, agsize=65536 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=1, rmapbt=1 = reflink=0 bigtime=1 inobtcount=1 nrext64=1 = exchange=1 metadir=1 data = bsize=4096 blocks=262144, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1, parent=0 log =internal log bsize=4096 blocks=16384, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =/dev/loop2 extsz=4096 blocks=262144, rtextents=262144 = rgcount=4 rgsize=65536 extents = zoned=0 start=0 reserved=0 Discarding blocks...Done. Discarding blocks...Done. $ mount -o rtdev=/dev/loop2 /dev/loop1 /mnt1/scratch $ xfs_growfs -R $(( 65536 * 4 + 1 )) /mnt1/scratch meta-data=/dev/loop1 isize=512 agcount=4, agsize=65536 blks = sectsz=512 attr=2, projid32bit=1 = crc=1 finobt=1, sparse=1, rmapbt=1 = reflink=0 bigtime=1 inobtcount=1 nrext64=1 = exchange=1 metadir=1 data = bsize=4096 blocks=262144, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0, ftype=1, parent=0 log =internal log bsize=4096 blocks=16384, version=2 = sectsz=512 sunit=0 blks, lazy-count=1 realtime =/dev/loop2 extsz=4096 blocks=262144, rtextents=262144 = rgcount=4 rgsize=65536 extents = zoned=0 start=0 reserved=0 calling xfsctl with in.newblocks = 262145 realtime blocks changed from 262144 to 262145 $ xfs_scrub -n -v /mnt1/scratch Phase 1: Find filesystem geometry. /mnt1/scratch: using 2 threads to scrub. Phase 2: Check internal metadata. Corruption: rtgroup 4 realtime summary: Repairs are required. Phase 3: Scan all inodes. Phase 5: Check directory tree. Info: /mnt1/scratch: Filesystem has errors, skipping connectivity checks. Phase 7: Check summary counters. Corruption: filesystem summary counters: Repairs are required. 125.0MiB data used; 8.0KiB realtime data used; 15 inodes used. 64.3MiB data found; 4.0KiB realtime data found; 18 inodes found. 18 inodes counted; 18 inodes checked. Phase 8: Trim filesystem storage. /mnt1/scratch: corruptions found: 2 /mnt1/scratch: Re-run xfs_scrub without -n.Cc <[email protected]> # v6.13Fixes e3088ae2dcae3c ("xfs: move RT bitmap and summary information to the rtgroup")Reviewed-by "Darrick J. Wong" <[email protected]>Reviewed-by Carlos Maiolino <[email protected]>Signed-off-by Nirjhar Roy (IBM) <[email protected]>--- fs/xfs/libxfs/xfs_rtbitmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/xfs/libxfs/xfs_rtbitmap.c +1
-1@@ -1170,7 +1170,7 @@ xfs_rtalloc_query_range(if (start > end)return -EINVAL ; -if (start == end || start >= rtg->rtg_extents) +if (start >= rtg->rtg_extents)return 0 ; end =min (end, rtg->rtg_extents -1 );Signature · 1 line
2.43.5Signature · 3 lines
Nirjhar Roy Linux Kernel Developer IBM, Bangalore
Signature · 3 lines
Nirjhar Roy Linux Kernel Developer IBM, Bangalore
Quoted 9 lines · Nirjhar Roy (IBM)
This patchset has 2 fixes in some XFS realtime code. Details are in the commit messages.
[v3] -> v4
1.Patch 1/2 -> Replaced the ASSERT with an
XFS_IS_CORRUPT2.Patch 2/2 -> Removed an extra line between tags[...]
Applied to for-next, thanks!
[1/2] xfs: Replace ASSERT with XFS_IS_CORRUPT in xfs_rtcopy_summary()
commit: ce95c72c7f95b820ca124e4a2b0d2b84224d6971
[2/2] xfs: Fix in xfs_rtalloc_query_range()
commit: 60cb35d383aa5d185685e301e27346b51bf48026Best regards,
Signature · 1 line
Carlos Maiolino <[email protected]>
Quoted 8 lines · Carlos Maiolino
Quoted 7 lines · Nirjhar Roy (IBM)
This patchset has 2 fixes in some XFS realtime code. Details are in the commit messages.
[v3] -> v4
1.Patch 1/2 -> Replaced the ASSERT with an
XFS_IS_CORRUPT2.Patch 2/2 -> Removed an extra line between tags
Thank you.
--NR
Quoted 10 lines
Quoted 2 lines
[...]
Applied to for-next, thanks!
[1/2] xfs: Replace ASSERT with
XFS_IS_CORRUPTinxfs_rtcopy_summary()commit: ce95c72c7f95b820ca124e4a2b0d2b84224d6971 [2/2] xfs: Fix in xfs_rtalloc_query_range() commit: 60cb35d383aa5d185685e301e27346b51bf48026Best regards,
Signature · 3 lines
Nirjhar Roy Linux Kernel Developer IBM, Bangalore