public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCHSET] fstests: random fixes for v2024.10.28
@ 2024-11-13  1:36 Darrick J. Wong
  2024-11-13  1:36 ` [PATCH 1/3] xfs/273: check thoroughness of the mappings Darrick J. Wong
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Darrick J. Wong @ 2024-11-13  1:36 UTC (permalink / raw)
  To: zlang, djwong; +Cc: fstests, fstests, linux-xfs

Hi all,

Here's the usual odd fixes for fstests.  Most of these are cleanups and
bug fixes that have been aging in my djwong-wtf branch forever.

If you're going to start using this code, I strongly recommend pulling
from my git trees, which are linked below.

With a bit of luck, this should all go splendidly.
Comments and questions are, as always, welcome.

--D

kernel git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfs-linux.git/log/?h=random-fixes

xfsprogs git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfsprogs-dev.git/log/?h=random-fixes

fstests git tree:
https://git.kernel.org/cgit/linux/kernel/git/djwong/xfstests-dev.git/log/?h=random-fixes
---
Commits in this patchset:
 * xfs/273: check thoroughness of the mappings
 * xfs/185: don't fail when rtfile is larger than rblocks
 * generic/757: fix various bugs in this test
---
 tests/generic/757 |    7 ++++++-
 tests/xfs/185     |    6 ++++--
 tests/xfs/273     |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 57 insertions(+), 3 deletions(-)


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/3] xfs/273: check thoroughness of the mappings
  2024-11-13  1:36 [PATCHSET] fstests: random fixes for v2024.10.28 Darrick J. Wong
@ 2024-11-13  1:36 ` Darrick J. Wong
  2024-11-13  8:46   ` Christoph Hellwig
  2024-11-15 10:13   ` Zorro Lang
  2024-11-13  1:37 ` [PATCH 2/3] xfs/185: don't fail when rtfile is larger than rblocks Darrick J. Wong
  2024-11-13  1:37 ` [PATCH 3/3] generic/757: fix various bugs in this test Darrick J. Wong
  2 siblings, 2 replies; 14+ messages in thread
From: Darrick J. Wong @ 2024-11-13  1:36 UTC (permalink / raw)
  To: zlang, djwong; +Cc: fstests, linux-xfs

From: Darrick J. Wong <djwong@kernel.org>

Enhance this test to make sure that there are no gaps in the fsmap
records, and (especially) that they we report all the way to the end of
the device.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/xfs/273 |   47 +++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)


diff --git a/tests/xfs/273 b/tests/xfs/273
index d7fb80c4033429..9f11540a77603d 100755
--- a/tests/xfs/273
+++ b/tests/xfs/273
@@ -24,6 +24,8 @@ _require_scratch
 _require_populate_commands
 _require_xfs_io_command "fsmap"
 
+_fixed_by_kernel_commit XXXXXXXXXXXXXX "xfs: fix off-by-one error in fsmap"
+
 rm -f "$seqres.full"
 
 echo "Format and mount"
@@ -37,6 +39,51 @@ cat $TEST_DIR/a $TEST_DIR/b >> $seqres.full
 
 diff -uw $TEST_DIR/a $TEST_DIR/b
 
+# Do we have mappings for every sector on the device?
+ddev_fsblocks=$(_xfs_statfs_field "$SCRATCH_MNT" geom.datablocks)
+rtdev_fsblocks=$(_xfs_statfs_field "$SCRATCH_MNT" geom.rtblocks)
+fsblock_bytes=$(_xfs_statfs_field "$SCRATCH_MNT" geom.bsize)
+
+ddev_daddrs=$((ddev_fsblocks * fsblock_bytes / 512))
+rtdev_daddrs=$((rtdev_fsblocks * fsblock_bytes / 512))
+
+ddev_devno=$(stat -c '%t:%T' $SCRATCH_DEV)
+if [ "$USE_EXTERNAL" = "yes" ] && [ -n "$SCRATCH_RTDEV" ]; then
+	rtdev_devno=$(stat -c '%t:%T' $SCRATCH_RTDEV)
+fi
+
+$XFS_IO_PROG -c 'fsmap -m -n 65536' $SCRATCH_MNT | awk -F ',' \
+	-v data_devno=$ddev_devno \
+	-v rt_devno=$rtdev_devno \
+	-v data_daddrs=$ddev_daddrs \
+	-v rt_daddrs=$rtdev_daddrs \
+'BEGIN {
+	next_daddr[data_devno] = 0;
+	next_daddr[rt_devno] = 0;
+}
+{
+	if ($1 == "EXT")
+		next
+	devno = sprintf("%x:%x", $2, $3);
+	if (devno != data_devno && devno != rt_devno)
+		next
+
+	if (next_daddr[devno] < $4)
+		printf("%sh: expected daddr %d, saw \"%s\"\n", devno,
+				next_daddr[devno], $0);
+		n = $5 + 1;
+		if (n > next_daddr[devno])
+		       next_daddr[devno] = n;
+}
+END {
+	if (data_daddrs != next_daddr[data_devno])
+		printf("%sh: fsmap stops at %d, expected %d\n",
+				data_devno, next_daddr[data_devno], data_daddrs);
+	if (rt_devno != "" && rt_daddrs != next_daddr[rt_devno])
+		printf("%sh: fsmap stops at %d, expected %d\n",
+				rt_devno, next_daddr[rt_devno], rt_daddrs);
+}'
+
 # success, all done
 status=0
 exit


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/3] xfs/185: don't fail when rtfile is larger than rblocks
  2024-11-13  1:36 [PATCHSET] fstests: random fixes for v2024.10.28 Darrick J. Wong
  2024-11-13  1:36 ` [PATCH 1/3] xfs/273: check thoroughness of the mappings Darrick J. Wong
@ 2024-11-13  1:37 ` Darrick J. Wong
  2024-11-13  8:47   ` Christoph Hellwig
  2024-11-15 10:13   ` Zorro Lang
  2024-11-13  1:37 ` [PATCH 3/3] generic/757: fix various bugs in this test Darrick J. Wong
  2 siblings, 2 replies; 14+ messages in thread
From: Darrick J. Wong @ 2024-11-13  1:37 UTC (permalink / raw)
  To: zlang, djwong; +Cc: fstests, fstests, linux-xfs

From: Darrick J. Wong <djwong@kernel.org>

This test creates a 200MB rt volume on a file-backed loopdev.  However,
if the size of the loop file is not congruent with the rt extent size
(e.g.  28k) then the rt volume will not use all 200MB because we cannot
have partial rt extents.  Because of this rounding, we can end up with
an fsmap listing that covers fewer sectors than the bmap of the loop
file.

Fix the test to allow this case.

Cc: <fstests@vger.kernel.org> # v2022.05.01
Fixes: 410a2e3186a1e8 ("xfs: regresion test for fsmap problems with realtime")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/xfs/185 |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)


diff --git a/tests/xfs/185 b/tests/xfs/185
index b14bcb9b791bb8..f3601a5292ef0b 100755
--- a/tests/xfs/185
+++ b/tests/xfs/185
@@ -156,7 +156,9 @@ fsmap() {
 
 # Check the fsmap output contains a record for the realtime device at a
 # physical offset higher than end of the data device and corresponding to the
-# beginning of the non-punched area.
+# beginning of the non-punched area.  The "found_end" check uses >= because
+# rtfile can be larger than the number of rtextents if the size of the rtfile
+# is not congruent with the rt extent size.
 fsmap | $AWK_PROG -v dev="$rtmajor:$rtminor" -v offset=$expected_offset -v end=$expected_end '
 BEGIN {
 	found_start = 0;
@@ -165,7 +167,7 @@ BEGIN {
 {
 	if ($1 == dev && $2 >= offset) {
 		found_start = 1;
-		if ($3 == end) {
+		if ($3 >= end) {
 			found_end = 1;
 		}
 	}


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/3] generic/757: fix various bugs in this test
  2024-11-13  1:36 [PATCHSET] fstests: random fixes for v2024.10.28 Darrick J. Wong
  2024-11-13  1:36 ` [PATCH 1/3] xfs/273: check thoroughness of the mappings Darrick J. Wong
  2024-11-13  1:37 ` [PATCH 2/3] xfs/185: don't fail when rtfile is larger than rblocks Darrick J. Wong
@ 2024-11-13  1:37 ` Darrick J. Wong
  2024-11-13  8:48   ` Christoph Hellwig
  2024-11-14  5:23   ` Zorro Lang
  2 siblings, 2 replies; 14+ messages in thread
From: Darrick J. Wong @ 2024-11-13  1:37 UTC (permalink / raw)
  To: zlang, djwong; +Cc: fstests, linux-xfs

From: Darrick J. Wong <djwong@kernel.org>

Fix this test so the check doesn't fail on XFS, and restrict runtime to
100 loops because otherwise this test takes many hours.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/generic/757 |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)


diff --git a/tests/generic/757 b/tests/generic/757
index 0ff5a8ac00182b..9d41975bde07bb 100755
--- a/tests/generic/757
+++ b/tests/generic/757
@@ -63,9 +63,14 @@ prev=$(_log_writes_mark_to_entry_number mkfs)
 cur=$(_log_writes_find_next_fua $prev)
 [ -z "$cur" ] && _fail "failed to locate next FUA write"
 
-while [ ! -z "$cur" ]; do
+for ((i = 0; i < 100; i++)); do
 	_log_writes_replay_log_range $cur $SCRATCH_DEV >> $seqres.full
 
+	# xfs_repair won't run if the log is dirty
+	if [ $FSTYP = "xfs" ]; then
+		_scratch_mount
+		_scratch_unmount
+	fi
 	_check_scratch_fs
 
 	prev=$cur


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] xfs/273: check thoroughness of the mappings
  2024-11-13  1:36 ` [PATCH 1/3] xfs/273: check thoroughness of the mappings Darrick J. Wong
@ 2024-11-13  8:46   ` Christoph Hellwig
  2024-11-15 10:13   ` Zorro Lang
  1 sibling, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2024-11-13  8:46 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: zlang, fstests, linux-xfs

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/3] xfs/185: don't fail when rtfile is larger than rblocks
  2024-11-13  1:37 ` [PATCH 2/3] xfs/185: don't fail when rtfile is larger than rblocks Darrick J. Wong
@ 2024-11-13  8:47   ` Christoph Hellwig
  2024-11-15 10:13   ` Zorro Lang
  1 sibling, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2024-11-13  8:47 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: zlang, fstests, linux-xfs

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/3] generic/757: fix various bugs in this test
  2024-11-13  1:37 ` [PATCH 3/3] generic/757: fix various bugs in this test Darrick J. Wong
@ 2024-11-13  8:48   ` Christoph Hellwig
  2024-11-14  5:23   ` Zorro Lang
  1 sibling, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2024-11-13  8:48 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: zlang, fstests, linux-xfs

On Tue, Nov 12, 2024 at 05:37:29PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Fix this test so the check doesn't fail on XFS, and restrict runtime to
> 100 loops because otherwise this test takes many hours.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/3] generic/757: fix various bugs in this test
  2024-11-13  1:37 ` [PATCH 3/3] generic/757: fix various bugs in this test Darrick J. Wong
  2024-11-13  8:48   ` Christoph Hellwig
@ 2024-11-14  5:23   ` Zorro Lang
  2024-11-14  5:30     ` Darrick J. Wong
  1 sibling, 1 reply; 14+ messages in thread
From: Zorro Lang @ 2024-11-14  5:23 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: fstests, linux-xfs

On Tue, Nov 12, 2024 at 05:37:29PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Fix this test so the check doesn't fail on XFS, and restrict runtime to
> 100 loops because otherwise this test takes many hours.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  tests/generic/757 |    7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> 
> diff --git a/tests/generic/757 b/tests/generic/757
> index 0ff5a8ac00182b..9d41975bde07bb 100755
> --- a/tests/generic/757
> +++ b/tests/generic/757
> @@ -63,9 +63,14 @@ prev=$(_log_writes_mark_to_entry_number mkfs)
>  cur=$(_log_writes_find_next_fua $prev)
>  [ -z "$cur" ] && _fail "failed to locate next FUA write"
>  
> -while [ ! -z "$cur" ]; do
> +for ((i = 0; i < 100; i++)); do
>  	_log_writes_replay_log_range $cur $SCRATCH_DEV >> $seqres.full
>  
> +	# xfs_repair won't run if the log is dirty
> +	if [ $FSTYP = "xfs" ]; then
> +		_scratch_mount

Hi Darrick, can you mount at here? I always get mount error as below:

SECTION       -- default
FSTYP         -- xfs (non-debug)
PLATFORM      -- Linux/x86_64 dell-per750-41 6.12.0-0.rc5.44.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Oct 28 14:12:55 UTC 2024
MKFS_OPTIONS  -- -f /dev/sda6
MOUNT_OPTIONS -- -o context=system_u:object_r:root_t:s0 /dev/sda6 /mnt/scratch

generic/757 2185s ... [failed, exit status 1]- output mismatch (see /root/git/xfstests/results//default/generic/757.out.bad)
    --- tests/generic/757.out   2024-10-27 03:09:48.740518275 +0800
    +++ /root/git/xfstests/results//default/generic/757.out.bad 2024-11-14 13:18:56.965210155 +0800
    @@ -1,2 +1,5 @@
     QA output created by 757
    -Silence is golden
    +mount: /mnt/scratch: cannot mount; probably corrupted filesystem on /dev/sda6.
    +       dmesg(1) may have more information after failed mount system call.
    +mount -o context=system_u:object_r:root_t:s0 /dev/sda6 /mnt/scratch failed
    +(see /root/git/xfstests/results//default/generic/757.full for details)
    ...
    (Run 'diff -u /root/git/xfstests/tests/generic/757.out /root/git/xfstests/results//default/generic/757.out.bad'  to see the entire diff)
Ran: generic/757
Failures: generic/757
Failed 1 of 1 tests

# dmesg
...
[1258572.169378] XFS (sda6): Mounting V5 Filesystem a0bf3918-1b66-4973-b03c-afd5197a6d21
[1258572.193037] XFS (sda6): Starting recovery (logdev: internal)
[1258572.201691] XFS (sda6): Corruption warning: Metadata has LSN (1:41116) ahead of current LSN (1:161). Please unmount and run xfs_repair (>= v4.3) to resolve.
[1258572.215850] XFS (sda6): Metadata CRC error detected at xfs_bmbt_read_verify+0x16/0xc0 [xfs], xfs_bmbt block 0x2000e8 
[1258572.226825] XFS (sda6): Unmount and run xfs_repair
[1258572.231796] XFS (sda6): First 128 bytes of corrupted metadata buffer:
[1258572.238411] 00000000: 42 4d 41 33 00 00 00 fb 00 00 00 00 00 04 00 9e  BMA3............
[1258572.246585] 00000010: 00 00 00 00 00 04 00 60 00 00 00 00 00 20 00 e8  .......`..... ..
[1258572.254766] 00000020: 00 00 00 01 00 00 a0 9c a0 bf 39 18 1b 66 49 73  ..........9..fIs
[1258572.262945] 00000030: b0 3c af d5 19 7a 6d 21 00 00 00 00 00 00 00 83  .<...zm!........
[1258572.271117] 00000040: 17 2f 1b e4 00 00 00 00 00 00 00 00 04 b1 2e 00  ./..............
[1258572.279291] 00000050: 00 00 00 4b 15 e0 00 01 80 00 00 00 04 b1 30 00  ...K..........0.
[1258572.287462] 00000060: 00 00 00 4b 16 00 00 4f 00 00 00 00 04 b1 ce 00  ...K...O........
[1258572.295635] 00000070: 00 00 00 4b 1f e0 00 01 80 00 00 00 04 b1 d0 00  ...K............
[1258572.303811] XFS (sda6): Filesystem has been shut down due to log error (0x2).
[1258572.311123] XFS (sda6): Please unmount the filesystem and rectify the problem(s).
[1258572.318791] XFS (sda6): log mount/recovery failed: error -74
[1258572.324798] XFS (sda6): log mount failed
[1258572.365169] XFS (sda5): Unmounting Filesystem eb4b7840-2c01-4306-9a6c-af2e7207a23f

> +		_scratch_unmount
> +	fi


>  	_check_scratch_fs
>  
>  	prev=$cur
> 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/3] generic/757: fix various bugs in this test
  2024-11-14  5:23   ` Zorro Lang
@ 2024-11-14  5:30     ` Darrick J. Wong
  2024-11-15  5:42       ` Zorro Lang
  0 siblings, 1 reply; 14+ messages in thread
From: Darrick J. Wong @ 2024-11-14  5:30 UTC (permalink / raw)
  To: Zorro Lang; +Cc: fstests, linux-xfs

On Thu, Nov 14, 2024 at 01:23:28PM +0800, Zorro Lang wrote:
> On Tue, Nov 12, 2024 at 05:37:29PM -0800, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > Fix this test so the check doesn't fail on XFS, and restrict runtime to
> > 100 loops because otherwise this test takes many hours.
> > 
> > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > ---
> >  tests/generic/757 |    7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > 
> > diff --git a/tests/generic/757 b/tests/generic/757
> > index 0ff5a8ac00182b..9d41975bde07bb 100755
> > --- a/tests/generic/757
> > +++ b/tests/generic/757
> > @@ -63,9 +63,14 @@ prev=$(_log_writes_mark_to_entry_number mkfs)
> >  cur=$(_log_writes_find_next_fua $prev)
> >  [ -z "$cur" ] && _fail "failed to locate next FUA write"
> >  
> > -while [ ! -z "$cur" ]; do
> > +for ((i = 0; i < 100; i++)); do
> >  	_log_writes_replay_log_range $cur $SCRATCH_DEV >> $seqres.full
> >  
> > +	# xfs_repair won't run if the log is dirty
> > +	if [ $FSTYP = "xfs" ]; then
> > +		_scratch_mount
> 
> Hi Darrick, can you mount at here? I always get mount error as below:
> 
> SECTION       -- default
> FSTYP         -- xfs (non-debug)
> PLATFORM      -- Linux/x86_64 dell-per750-41 6.12.0-0.rc5.44.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Oct 28 14:12:55 UTC 2024
> MKFS_OPTIONS  -- -f /dev/sda6
> MOUNT_OPTIONS -- -o context=system_u:object_r:root_t:s0 /dev/sda6 /mnt/scratch
> 
> generic/757 2185s ... [failed, exit status 1]- output mismatch (see /root/git/xfstests/results//default/generic/757.out.bad)
>     --- tests/generic/757.out   2024-10-27 03:09:48.740518275 +0800
>     +++ /root/git/xfstests/results//default/generic/757.out.bad 2024-11-14 13:18:56.965210155 +0800
>     @@ -1,2 +1,5 @@
>      QA output created by 757
>     -Silence is golden
>     +mount: /mnt/scratch: cannot mount; probably corrupted filesystem on /dev/sda6.
>     +       dmesg(1) may have more information after failed mount system call.
>     +mount -o context=system_u:object_r:root_t:s0 /dev/sda6 /mnt/scratch failed
>     +(see /root/git/xfstests/results//default/generic/757.full for details)
>     ...
>     (Run 'diff -u /root/git/xfstests/tests/generic/757.out /root/git/xfstests/results//default/generic/757.out.bad'  to see the entire diff)
> Ran: generic/757
> Failures: generic/757
> Failed 1 of 1 tests
> 
> # dmesg
> ...
> [1258572.169378] XFS (sda6): Mounting V5 Filesystem a0bf3918-1b66-4973-b03c-afd5197a6d21
> [1258572.193037] XFS (sda6): Starting recovery (logdev: internal)
> [1258572.201691] XFS (sda6): Corruption warning: Metadata has LSN (1:41116) ahead of current LSN (1:161). Please unmount and run xfs_repair (>= v4.3) to resolve.
> [1258572.215850] XFS (sda6): Metadata CRC error detected at xfs_bmbt_read_verify+0x16/0xc0 [xfs], xfs_bmbt block 0x2000e8 
> [1258572.226825] XFS (sda6): Unmount and run xfs_repair
> [1258572.231796] XFS (sda6): First 128 bytes of corrupted metadata buffer:
> [1258572.238411] 00000000: 42 4d 41 33 00 00 00 fb 00 00 00 00 00 04 00 9e  BMA3............
> [1258572.246585] 00000010: 00 00 00 00 00 04 00 60 00 00 00 00 00 20 00 e8  .......`..... ..
> [1258572.254766] 00000020: 00 00 00 01 00 00 a0 9c a0 bf 39 18 1b 66 49 73  ..........9..fIs
> [1258572.262945] 00000030: b0 3c af d5 19 7a 6d 21 00 00 00 00 00 00 00 83  .<...zm!........
> [1258572.271117] 00000040: 17 2f 1b e4 00 00 00 00 00 00 00 00 04 b1 2e 00  ./..............
> [1258572.279291] 00000050: 00 00 00 4b 15 e0 00 01 80 00 00 00 04 b1 30 00  ...K..........0.
> [1258572.287462] 00000060: 00 00 00 4b 16 00 00 4f 00 00 00 00 04 b1 ce 00  ...K...O........
> [1258572.295635] 00000070: 00 00 00 4b 1f e0 00 01 80 00 00 00 04 b1 d0 00  ...K............
> [1258572.303811] XFS (sda6): Filesystem has been shut down due to log error (0x2).
> [1258572.311123] XFS (sda6): Please unmount the filesystem and rectify the problem(s).
> [1258572.318791] XFS (sda6): log mount/recovery failed: error -74
> [1258572.324798] XFS (sda6): log mount failed
> [1258572.365169] XFS (sda5): Unmounting Filesystem eb4b7840-2c01-4306-9a6c-af2e7207a23f

I see periodic corruption messages, but generally the mount succeeds and
the test passes, even with TOT -rc6.

--D

> > +		_scratch_unmount
> > +	fi
> 
> 
> >  	_check_scratch_fs
> >  
> >  	prev=$cur
> > 
> 
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/3] generic/757: fix various bugs in this test
  2024-11-14  5:30     ` Darrick J. Wong
@ 2024-11-15  5:42       ` Zorro Lang
  2024-11-15 17:30         ` Darrick J. Wong
  0 siblings, 1 reply; 14+ messages in thread
From: Zorro Lang @ 2024-11-15  5:42 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: fstests, linux-xfs

On Wed, Nov 13, 2024 at 09:30:19PM -0800, Darrick J. Wong wrote:
> On Thu, Nov 14, 2024 at 01:23:28PM +0800, Zorro Lang wrote:
> > On Tue, Nov 12, 2024 at 05:37:29PM -0800, Darrick J. Wong wrote:
> > > From: Darrick J. Wong <djwong@kernel.org>
> > > 
> > > Fix this test so the check doesn't fail on XFS, and restrict runtime to
> > > 100 loops because otherwise this test takes many hours.
> > > 
> > > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > > ---
> > >  tests/generic/757 |    7 ++++++-
> > >  1 file changed, 6 insertions(+), 1 deletion(-)
> > > 
> > > 
> > > diff --git a/tests/generic/757 b/tests/generic/757
> > > index 0ff5a8ac00182b..9d41975bde07bb 100755
> > > --- a/tests/generic/757
> > > +++ b/tests/generic/757
> > > @@ -63,9 +63,14 @@ prev=$(_log_writes_mark_to_entry_number mkfs)
> > >  cur=$(_log_writes_find_next_fua $prev)
> > >  [ -z "$cur" ] && _fail "failed to locate next FUA write"
> > >  
> > > -while [ ! -z "$cur" ]; do
> > > +for ((i = 0; i < 100; i++)); do
> > >  	_log_writes_replay_log_range $cur $SCRATCH_DEV >> $seqres.full
> > >  
> > > +	# xfs_repair won't run if the log is dirty
> > > +	if [ $FSTYP = "xfs" ]; then
> > > +		_scratch_mount
> > 
> > Hi Darrick, can you mount at here? I always get mount error as below:
> > 
> > SECTION       -- default
> > FSTYP         -- xfs (non-debug)
> > PLATFORM      -- Linux/x86_64 dell-per750-41 6.12.0-0.rc5.44.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Oct 28 14:12:55 UTC 2024
> > MKFS_OPTIONS  -- -f /dev/sda6
> > MOUNT_OPTIONS -- -o context=system_u:object_r:root_t:s0 /dev/sda6 /mnt/scratch
> > 
> > generic/757 2185s ... [failed, exit status 1]- output mismatch (see /root/git/xfstests/results//default/generic/757.out.bad)
> >     --- tests/generic/757.out   2024-10-27 03:09:48.740518275 +0800
> >     +++ /root/git/xfstests/results//default/generic/757.out.bad 2024-11-14 13:18:56.965210155 +0800
> >     @@ -1,2 +1,5 @@
> >      QA output created by 757
> >     -Silence is golden
> >     +mount: /mnt/scratch: cannot mount; probably corrupted filesystem on /dev/sda6.
> >     +       dmesg(1) may have more information after failed mount system call.
> >     +mount -o context=system_u:object_r:root_t:s0 /dev/sda6 /mnt/scratch failed
> >     +(see /root/git/xfstests/results//default/generic/757.full for details)
> >     ...
> >     (Run 'diff -u /root/git/xfstests/tests/generic/757.out /root/git/xfstests/results//default/generic/757.out.bad'  to see the entire diff)
> > Ran: generic/757
> > Failures: generic/757
> > Failed 1 of 1 tests
> > 
> > # dmesg
> > ...
> > [1258572.169378] XFS (sda6): Mounting V5 Filesystem a0bf3918-1b66-4973-b03c-afd5197a6d21
> > [1258572.193037] XFS (sda6): Starting recovery (logdev: internal)
> > [1258572.201691] XFS (sda6): Corruption warning: Metadata has LSN (1:41116) ahead of current LSN (1:161). Please unmount and run xfs_repair (>= v4.3) to resolve.
> > [1258572.215850] XFS (sda6): Metadata CRC error detected at xfs_bmbt_read_verify+0x16/0xc0 [xfs], xfs_bmbt block 0x2000e8 
> > [1258572.226825] XFS (sda6): Unmount and run xfs_repair
> > [1258572.231796] XFS (sda6): First 128 bytes of corrupted metadata buffer:
> > [1258572.238411] 00000000: 42 4d 41 33 00 00 00 fb 00 00 00 00 00 04 00 9e  BMA3............
> > [1258572.246585] 00000010: 00 00 00 00 00 04 00 60 00 00 00 00 00 20 00 e8  .......`..... ..
> > [1258572.254766] 00000020: 00 00 00 01 00 00 a0 9c a0 bf 39 18 1b 66 49 73  ..........9..fIs
> > [1258572.262945] 00000030: b0 3c af d5 19 7a 6d 21 00 00 00 00 00 00 00 83  .<...zm!........
> > [1258572.271117] 00000040: 17 2f 1b e4 00 00 00 00 00 00 00 00 04 b1 2e 00  ./..............
> > [1258572.279291] 00000050: 00 00 00 4b 15 e0 00 01 80 00 00 00 04 b1 30 00  ...K..........0.
> > [1258572.287462] 00000060: 00 00 00 4b 16 00 00 4f 00 00 00 00 04 b1 ce 00  ...K...O........
> > [1258572.295635] 00000070: 00 00 00 4b 1f e0 00 01 80 00 00 00 04 b1 d0 00  ...K............
> > [1258572.303811] XFS (sda6): Filesystem has been shut down due to log error (0x2).
> > [1258572.311123] XFS (sda6): Please unmount the filesystem and rectify the problem(s).
> > [1258572.318791] XFS (sda6): log mount/recovery failed: error -74
> > [1258572.324798] XFS (sda6): log mount failed
> > [1258572.365169] XFS (sda5): Unmounting Filesystem eb4b7840-2c01-4306-9a6c-af2e7207a23f
> 
> I see periodic corruption messages, but generally the mount succeeds and
> the test passes, even with TOT -rc6.

Still fails on -rc7+ [1]. Even with `xfs_repair $SCRATCH_DEV` before mount, it still fails [2].
But `xfs_repair -L` helps, the test can keep running after that.

Do you think it's a xfs issue, or a case issue (xfs need a log cleanup at here?).

Thanks,
Zorro

[1]
# ./check -s default generic/757
SECTION       -- default
FSTYP         -- xfs (non-debug)
PLATFORM      -- Linux/x86_64 dell-per750-41 6.12.0-0.rc7.58.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Nov 11 15:23:45 UTC 2024
MKFS_OPTIONS  -- -f /dev/sda6
MOUNT_OPTIONS -- -o context=system_u:object_r:root_t:s0 /dev/sda6 /mnt/scratch

generic/757 2185s ... [failed, exit status 1]- output mismatch (see /root/git/xfstests/results//default/generic/757.out.bad)
    --- tests/generic/757.out   2024-10-27 03:09:48.740518275 +0800
    +++ /root/git/xfstests/results//default/generic/757.out.bad 2024-11-15 03:06:59.462739215 +0800
    @@ -1,2 +1,5 @@
     QA output created by 757
    -Silence is golden
    +mount: /mnt/scratch: cannot mount; probably corrupted filesystem on /dev/sda6.
    +       dmesg(1) may have more information after failed mount system call.
    +mount -o context=system_u:object_r:root_t:s0 /dev/sda6 /mnt/scratch failed
    +(see /root/git/xfstests/results//default/generic/757.full for details)
    ...
    (Run 'diff -u /root/git/xfstests/tests/generic/757.out /root/git/xfstests/results//default/generic/757.out.bad'  to see the entire diff)
Ran: generic/757
Failures: generic/757
Failed 1 of 1 tests

[2]
Phase 1 - find and verify superblock...
Phase 2 - using internal log
        - zero log...
ERROR: The filesystem has valuable metadata changes in a log which needs to
be replayed.  Mount the filesystem to replay the log, and unmount it before
re-running xfs_repair.  If you are unable to mount the filesystem, then use
the -L option to destroy the log and attempt a repair.
Note that destroying the log may cause corruption -- please attempt a mount
of the filesystem before doing this.

> 
> --D
> 
> > > +		_scratch_unmount
> > > +	fi
> > 
> > 
> > >  	_check_scratch_fs
> > >  
> > >  	prev=$cur
> > > 
> > 
> > 
> 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/3] xfs/273: check thoroughness of the mappings
  2024-11-13  1:36 ` [PATCH 1/3] xfs/273: check thoroughness of the mappings Darrick J. Wong
  2024-11-13  8:46   ` Christoph Hellwig
@ 2024-11-15 10:13   ` Zorro Lang
  1 sibling, 0 replies; 14+ messages in thread
From: Zorro Lang @ 2024-11-15 10:13 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: fstests, linux-xfs

On Tue, Nov 12, 2024 at 05:36:58PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Enhance this test to make sure that there are no gaps in the fsmap
> records, and (especially) that they we report all the way to the end of
> the device.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---

This version is good to me now,

Reviewed-by: Zorro Lang <zlang@redhat.com>

>  tests/xfs/273 |   47 +++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 47 insertions(+)
> 
> 
> diff --git a/tests/xfs/273 b/tests/xfs/273
> index d7fb80c4033429..9f11540a77603d 100755
> --- a/tests/xfs/273
> +++ b/tests/xfs/273
> @@ -24,6 +24,8 @@ _require_scratch
>  _require_populate_commands
>  _require_xfs_io_command "fsmap"
>  
> +_fixed_by_kernel_commit XXXXXXXXXXXXXX "xfs: fix off-by-one error in fsmap"
> +
>  rm -f "$seqres.full"
>  
>  echo "Format and mount"
> @@ -37,6 +39,51 @@ cat $TEST_DIR/a $TEST_DIR/b >> $seqres.full
>  
>  diff -uw $TEST_DIR/a $TEST_DIR/b
>  
> +# Do we have mappings for every sector on the device?
> +ddev_fsblocks=$(_xfs_statfs_field "$SCRATCH_MNT" geom.datablocks)
> +rtdev_fsblocks=$(_xfs_statfs_field "$SCRATCH_MNT" geom.rtblocks)
> +fsblock_bytes=$(_xfs_statfs_field "$SCRATCH_MNT" geom.bsize)
> +
> +ddev_daddrs=$((ddev_fsblocks * fsblock_bytes / 512))
> +rtdev_daddrs=$((rtdev_fsblocks * fsblock_bytes / 512))
> +
> +ddev_devno=$(stat -c '%t:%T' $SCRATCH_DEV)
> +if [ "$USE_EXTERNAL" = "yes" ] && [ -n "$SCRATCH_RTDEV" ]; then
> +	rtdev_devno=$(stat -c '%t:%T' $SCRATCH_RTDEV)
> +fi
> +
> +$XFS_IO_PROG -c 'fsmap -m -n 65536' $SCRATCH_MNT | awk -F ',' \
> +	-v data_devno=$ddev_devno \
> +	-v rt_devno=$rtdev_devno \
> +	-v data_daddrs=$ddev_daddrs \
> +	-v rt_daddrs=$rtdev_daddrs \
> +'BEGIN {
> +	next_daddr[data_devno] = 0;
> +	next_daddr[rt_devno] = 0;
> +}
> +{
> +	if ($1 == "EXT")
> +		next
> +	devno = sprintf("%x:%x", $2, $3);
> +	if (devno != data_devno && devno != rt_devno)
> +		next
> +
> +	if (next_daddr[devno] < $4)
> +		printf("%sh: expected daddr %d, saw \"%s\"\n", devno,
> +				next_daddr[devno], $0);
> +		n = $5 + 1;
> +		if (n > next_daddr[devno])
> +		       next_daddr[devno] = n;
> +}
> +END {
> +	if (data_daddrs != next_daddr[data_devno])
> +		printf("%sh: fsmap stops at %d, expected %d\n",
> +				data_devno, next_daddr[data_devno], data_daddrs);
> +	if (rt_devno != "" && rt_daddrs != next_daddr[rt_devno])
> +		printf("%sh: fsmap stops at %d, expected %d\n",
> +				rt_devno, next_daddr[rt_devno], rt_daddrs);
> +}'
> +
>  # success, all done
>  status=0
>  exit
> 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/3] xfs/185: don't fail when rtfile is larger than rblocks
  2024-11-13  1:37 ` [PATCH 2/3] xfs/185: don't fail when rtfile is larger than rblocks Darrick J. Wong
  2024-11-13  8:47   ` Christoph Hellwig
@ 2024-11-15 10:13   ` Zorro Lang
  1 sibling, 0 replies; 14+ messages in thread
From: Zorro Lang @ 2024-11-15 10:13 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: fstests, linux-xfs

On Tue, Nov 12, 2024 at 05:37:14PM -0800, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> This test creates a 200MB rt volume on a file-backed loopdev.  However,
> if the size of the loop file is not congruent with the rt extent size
> (e.g.  28k) then the rt volume will not use all 200MB because we cannot
> have partial rt extents.  Because of this rounding, we can end up with
> an fsmap listing that covers fewer sectors than the bmap of the loop
> file.
> 
> Fix the test to allow this case.
> 
> Cc: <fstests@vger.kernel.org> # v2022.05.01
> Fixes: 410a2e3186a1e8 ("xfs: regresion test for fsmap problems with realtime")
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---

Makes sense to me,

Reviewed-by: Zorro Lang <zlang@redhat.com>

>  tests/xfs/185 |    6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> 
> diff --git a/tests/xfs/185 b/tests/xfs/185
> index b14bcb9b791bb8..f3601a5292ef0b 100755
> --- a/tests/xfs/185
> +++ b/tests/xfs/185
> @@ -156,7 +156,9 @@ fsmap() {
>  
>  # Check the fsmap output contains a record for the realtime device at a
>  # physical offset higher than end of the data device and corresponding to the
> -# beginning of the non-punched area.
> +# beginning of the non-punched area.  The "found_end" check uses >= because
> +# rtfile can be larger than the number of rtextents if the size of the rtfile
> +# is not congruent with the rt extent size.
>  fsmap | $AWK_PROG -v dev="$rtmajor:$rtminor" -v offset=$expected_offset -v end=$expected_end '
>  BEGIN {
>  	found_start = 0;
> @@ -165,7 +167,7 @@ BEGIN {
>  {
>  	if ($1 == dev && $2 >= offset) {
>  		found_start = 1;
> -		if ($3 == end) {
> +		if ($3 >= end) {
>  			found_end = 1;
>  		}
>  	}
> 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/3] generic/757: fix various bugs in this test
  2024-11-15  5:42       ` Zorro Lang
@ 2024-11-15 17:30         ` Darrick J. Wong
  2024-11-15 18:28           ` Zorro Lang
  0 siblings, 1 reply; 14+ messages in thread
From: Darrick J. Wong @ 2024-11-15 17:30 UTC (permalink / raw)
  To: Zorro Lang; +Cc: fstests, linux-xfs

On Fri, Nov 15, 2024 at 01:42:51PM +0800, Zorro Lang wrote:
> On Wed, Nov 13, 2024 at 09:30:19PM -0800, Darrick J. Wong wrote:
> > On Thu, Nov 14, 2024 at 01:23:28PM +0800, Zorro Lang wrote:
> > > On Tue, Nov 12, 2024 at 05:37:29PM -0800, Darrick J. Wong wrote:
> > > > From: Darrick J. Wong <djwong@kernel.org>
> > > > 
> > > > Fix this test so the check doesn't fail on XFS, and restrict runtime to
> > > > 100 loops because otherwise this test takes many hours.
> > > > 
> > > > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > > > ---
> > > >  tests/generic/757 |    7 ++++++-
> > > >  1 file changed, 6 insertions(+), 1 deletion(-)
> > > > 
> > > > 
> > > > diff --git a/tests/generic/757 b/tests/generic/757
> > > > index 0ff5a8ac00182b..9d41975bde07bb 100755
> > > > --- a/tests/generic/757
> > > > +++ b/tests/generic/757
> > > > @@ -63,9 +63,14 @@ prev=$(_log_writes_mark_to_entry_number mkfs)
> > > >  cur=$(_log_writes_find_next_fua $prev)
> > > >  [ -z "$cur" ] && _fail "failed to locate next FUA write"
> > > >  
> > > > -while [ ! -z "$cur" ]; do
> > > > +for ((i = 0; i < 100; i++)); do
> > > >  	_log_writes_replay_log_range $cur $SCRATCH_DEV >> $seqres.full
> > > >  
> > > > +	# xfs_repair won't run if the log is dirty
> > > > +	if [ $FSTYP = "xfs" ]; then
> > > > +		_scratch_mount
> > > 
> > > Hi Darrick, can you mount at here? I always get mount error as below:
> > > 
> > > SECTION       -- default
> > > FSTYP         -- xfs (non-debug)
> > > PLATFORM      -- Linux/x86_64 dell-per750-41 6.12.0-0.rc5.44.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Oct 28 14:12:55 UTC 2024
> > > MKFS_OPTIONS  -- -f /dev/sda6
> > > MOUNT_OPTIONS -- -o context=system_u:object_r:root_t:s0 /dev/sda6 /mnt/scratch
> > > 
> > > generic/757 2185s ... [failed, exit status 1]- output mismatch (see /root/git/xfstests/results//default/generic/757.out.bad)
> > >     --- tests/generic/757.out   2024-10-27 03:09:48.740518275 +0800
> > >     +++ /root/git/xfstests/results//default/generic/757.out.bad 2024-11-14 13:18:56.965210155 +0800
> > >     @@ -1,2 +1,5 @@
> > >      QA output created by 757
> > >     -Silence is golden
> > >     +mount: /mnt/scratch: cannot mount; probably corrupted filesystem on /dev/sda6.
> > >     +       dmesg(1) may have more information after failed mount system call.
> > >     +mount -o context=system_u:object_r:root_t:s0 /dev/sda6 /mnt/scratch failed
> > >     +(see /root/git/xfstests/results//default/generic/757.full for details)
> > >     ...
> > >     (Run 'diff -u /root/git/xfstests/tests/generic/757.out /root/git/xfstests/results//default/generic/757.out.bad'  to see the entire diff)
> > > Ran: generic/757
> > > Failures: generic/757
> > > Failed 1 of 1 tests
> > > 
> > > # dmesg
> > > ...
> > > [1258572.169378] XFS (sda6): Mounting V5 Filesystem a0bf3918-1b66-4973-b03c-afd5197a6d21
> > > [1258572.193037] XFS (sda6): Starting recovery (logdev: internal)
> > > [1258572.201691] XFS (sda6): Corruption warning: Metadata has LSN (1:41116) ahead of current LSN (1:161). Please unmount and run xfs_repair (>= v4.3) to resolve.
> > > [1258572.215850] XFS (sda6): Metadata CRC error detected at xfs_bmbt_read_verify+0x16/0xc0 [xfs], xfs_bmbt block 0x2000e8 
> > > [1258572.226825] XFS (sda6): Unmount and run xfs_repair
> > > [1258572.231796] XFS (sda6): First 128 bytes of corrupted metadata buffer:
> > > [1258572.238411] 00000000: 42 4d 41 33 00 00 00 fb 00 00 00 00 00 04 00 9e  BMA3............
> > > [1258572.246585] 00000010: 00 00 00 00 00 04 00 60 00 00 00 00 00 20 00 e8  .......`..... ..
> > > [1258572.254766] 00000020: 00 00 00 01 00 00 a0 9c a0 bf 39 18 1b 66 49 73  ..........9..fIs
> > > [1258572.262945] 00000030: b0 3c af d5 19 7a 6d 21 00 00 00 00 00 00 00 83  .<...zm!........
> > > [1258572.271117] 00000040: 17 2f 1b e4 00 00 00 00 00 00 00 00 04 b1 2e 00  ./..............
> > > [1258572.279291] 00000050: 00 00 00 4b 15 e0 00 01 80 00 00 00 04 b1 30 00  ...K..........0.
> > > [1258572.287462] 00000060: 00 00 00 4b 16 00 00 4f 00 00 00 00 04 b1 ce 00  ...K...O........
> > > [1258572.295635] 00000070: 00 00 00 4b 1f e0 00 01 80 00 00 00 04 b1 d0 00  ...K............
> > > [1258572.303811] XFS (sda6): Filesystem has been shut down due to log error (0x2).
> > > [1258572.311123] XFS (sda6): Please unmount the filesystem and rectify the problem(s).
> > > [1258572.318791] XFS (sda6): log mount/recovery failed: error -74
> > > [1258572.324798] XFS (sda6): log mount failed
> > > [1258572.365169] XFS (sda5): Unmounting Filesystem eb4b7840-2c01-4306-9a6c-af2e7207a23f
> > 
> > I see periodic corruption messages, but generally the mount succeeds and
> > the test passes, even with TOT -rc6.
> 
> Still fails on -rc7+ [1]. Even with `xfs_repair $SCRATCH_DEV` before mount, it still fails [2].
> But `xfs_repair -L` helps, the test can keep running after that.
> 
> Do you think it's a xfs issue, or a case issue (xfs need a log cleanup at here?).

I'm not sure.  Does your sda6 device support discards?  My VMs'
SCRATCH_DEVs usually support it, and I noticed that all the other
generic/ _log_writes_init tests set up a dm-thin volume so that the
replays can always zero out the whole device before jumping to a
snapshot.

--D

> Thanks,
> Zorro
> 
> [1]
> # ./check -s default generic/757
> SECTION       -- default
> FSTYP         -- xfs (non-debug)
> PLATFORM      -- Linux/x86_64 dell-per750-41 6.12.0-0.rc7.58.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Nov 11 15:23:45 UTC 2024
> MKFS_OPTIONS  -- -f /dev/sda6
> MOUNT_OPTIONS -- -o context=system_u:object_r:root_t:s0 /dev/sda6 /mnt/scratch
> 
> generic/757 2185s ... [failed, exit status 1]- output mismatch (see /root/git/xfstests/results//default/generic/757.out.bad)
>     --- tests/generic/757.out   2024-10-27 03:09:48.740518275 +0800
>     +++ /root/git/xfstests/results//default/generic/757.out.bad 2024-11-15 03:06:59.462739215 +0800
>     @@ -1,2 +1,5 @@
>      QA output created by 757
>     -Silence is golden
>     +mount: /mnt/scratch: cannot mount; probably corrupted filesystem on /dev/sda6.
>     +       dmesg(1) may have more information after failed mount system call.
>     +mount -o context=system_u:object_r:root_t:s0 /dev/sda6 /mnt/scratch failed
>     +(see /root/git/xfstests/results//default/generic/757.full for details)
>     ...
>     (Run 'diff -u /root/git/xfstests/tests/generic/757.out /root/git/xfstests/results//default/generic/757.out.bad'  to see the entire diff)
> Ran: generic/757
> Failures: generic/757
> Failed 1 of 1 tests
> 
> [2]
> Phase 1 - find and verify superblock...
> Phase 2 - using internal log
>         - zero log...
> ERROR: The filesystem has valuable metadata changes in a log which needs to
> be replayed.  Mount the filesystem to replay the log, and unmount it before
> re-running xfs_repair.  If you are unable to mount the filesystem, then use
> the -L option to destroy the log and attempt a repair.
> Note that destroying the log may cause corruption -- please attempt a mount
> of the filesystem before doing this.
> 
> > 
> > --D
> > 
> > > > +		_scratch_unmount
> > > > +	fi
> > > 
> > > 
> > > >  	_check_scratch_fs
> > > >  
> > > >  	prev=$cur
> > > > 
> > > 
> > > 
> > 
> 
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/3] generic/757: fix various bugs in this test
  2024-11-15 17:30         ` Darrick J. Wong
@ 2024-11-15 18:28           ` Zorro Lang
  0 siblings, 0 replies; 14+ messages in thread
From: Zorro Lang @ 2024-11-15 18:28 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: fstests, linux-xfs

On Fri, Nov 15, 2024 at 09:30:27AM -0800, Darrick J. Wong wrote:
> On Fri, Nov 15, 2024 at 01:42:51PM +0800, Zorro Lang wrote:
> > On Wed, Nov 13, 2024 at 09:30:19PM -0800, Darrick J. Wong wrote:
> > > On Thu, Nov 14, 2024 at 01:23:28PM +0800, Zorro Lang wrote:
> > > > On Tue, Nov 12, 2024 at 05:37:29PM -0800, Darrick J. Wong wrote:
> > > > > From: Darrick J. Wong <djwong@kernel.org>
> > > > > 
> > > > > Fix this test so the check doesn't fail on XFS, and restrict runtime to
> > > > > 100 loops because otherwise this test takes many hours.
> > > > > 
> > > > > Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> > > > > ---
> > > > >  tests/generic/757 |    7 ++++++-
> > > > >  1 file changed, 6 insertions(+), 1 deletion(-)
> > > > > 
> > > > > 
> > > > > diff --git a/tests/generic/757 b/tests/generic/757
> > > > > index 0ff5a8ac00182b..9d41975bde07bb 100755
> > > > > --- a/tests/generic/757
> > > > > +++ b/tests/generic/757
> > > > > @@ -63,9 +63,14 @@ prev=$(_log_writes_mark_to_entry_number mkfs)
> > > > >  cur=$(_log_writes_find_next_fua $prev)
> > > > >  [ -z "$cur" ] && _fail "failed to locate next FUA write"
> > > > >  
> > > > > -while [ ! -z "$cur" ]; do
> > > > > +for ((i = 0; i < 100; i++)); do
> > > > >  	_log_writes_replay_log_range $cur $SCRATCH_DEV >> $seqres.full
> > > > >  
> > > > > +	# xfs_repair won't run if the log is dirty
> > > > > +	if [ $FSTYP = "xfs" ]; then
> > > > > +		_scratch_mount
> > > > 
> > > > Hi Darrick, can you mount at here? I always get mount error as below:
> > > > 
> > > > SECTION       -- default
> > > > FSTYP         -- xfs (non-debug)
> > > > PLATFORM      -- Linux/x86_64 dell-per750-41 6.12.0-0.rc5.44.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Oct 28 14:12:55 UTC 2024
> > > > MKFS_OPTIONS  -- -f /dev/sda6
> > > > MOUNT_OPTIONS -- -o context=system_u:object_r:root_t:s0 /dev/sda6 /mnt/scratch
> > > > 
> > > > generic/757 2185s ... [failed, exit status 1]- output mismatch (see /root/git/xfstests/results//default/generic/757.out.bad)
> > > >     --- tests/generic/757.out   2024-10-27 03:09:48.740518275 +0800
> > > >     +++ /root/git/xfstests/results//default/generic/757.out.bad 2024-11-14 13:18:56.965210155 +0800
> > > >     @@ -1,2 +1,5 @@
> > > >      QA output created by 757
> > > >     -Silence is golden
> > > >     +mount: /mnt/scratch: cannot mount; probably corrupted filesystem on /dev/sda6.
> > > >     +       dmesg(1) may have more information after failed mount system call.
> > > >     +mount -o context=system_u:object_r:root_t:s0 /dev/sda6 /mnt/scratch failed
> > > >     +(see /root/git/xfstests/results//default/generic/757.full for details)
> > > >     ...
> > > >     (Run 'diff -u /root/git/xfstests/tests/generic/757.out /root/git/xfstests/results//default/generic/757.out.bad'  to see the entire diff)
> > > > Ran: generic/757
> > > > Failures: generic/757
> > > > Failed 1 of 1 tests
> > > > 
> > > > # dmesg
> > > > ...
> > > > [1258572.169378] XFS (sda6): Mounting V5 Filesystem a0bf3918-1b66-4973-b03c-afd5197a6d21
> > > > [1258572.193037] XFS (sda6): Starting recovery (logdev: internal)
> > > > [1258572.201691] XFS (sda6): Corruption warning: Metadata has LSN (1:41116) ahead of current LSN (1:161). Please unmount and run xfs_repair (>= v4.3) to resolve.
> > > > [1258572.215850] XFS (sda6): Metadata CRC error detected at xfs_bmbt_read_verify+0x16/0xc0 [xfs], xfs_bmbt block 0x2000e8 
> > > > [1258572.226825] XFS (sda6): Unmount and run xfs_repair
> > > > [1258572.231796] XFS (sda6): First 128 bytes of corrupted metadata buffer:
> > > > [1258572.238411] 00000000: 42 4d 41 33 00 00 00 fb 00 00 00 00 00 04 00 9e  BMA3............
> > > > [1258572.246585] 00000010: 00 00 00 00 00 04 00 60 00 00 00 00 00 20 00 e8  .......`..... ..
> > > > [1258572.254766] 00000020: 00 00 00 01 00 00 a0 9c a0 bf 39 18 1b 66 49 73  ..........9..fIs
> > > > [1258572.262945] 00000030: b0 3c af d5 19 7a 6d 21 00 00 00 00 00 00 00 83  .<...zm!........
> > > > [1258572.271117] 00000040: 17 2f 1b e4 00 00 00 00 00 00 00 00 04 b1 2e 00  ./..............
> > > > [1258572.279291] 00000050: 00 00 00 4b 15 e0 00 01 80 00 00 00 04 b1 30 00  ...K..........0.
> > > > [1258572.287462] 00000060: 00 00 00 4b 16 00 00 4f 00 00 00 00 04 b1 ce 00  ...K...O........
> > > > [1258572.295635] 00000070: 00 00 00 4b 1f e0 00 01 80 00 00 00 04 b1 d0 00  ...K............
> > > > [1258572.303811] XFS (sda6): Filesystem has been shut down due to log error (0x2).
> > > > [1258572.311123] XFS (sda6): Please unmount the filesystem and rectify the problem(s).
> > > > [1258572.318791] XFS (sda6): log mount/recovery failed: error -74
> > > > [1258572.324798] XFS (sda6): log mount failed
> > > > [1258572.365169] XFS (sda5): Unmounting Filesystem eb4b7840-2c01-4306-9a6c-af2e7207a23f
> > > 
> > > I see periodic corruption messages, but generally the mount succeeds and
> > > the test passes, even with TOT -rc6.
> > 
> > Still fails on -rc7+ [1]. Even with `xfs_repair $SCRATCH_DEV` before mount, it still fails [2].
> > But `xfs_repair -L` helps, the test can keep running after that.
> > 
> > Do you think it's a xfs issue, or a case issue (xfs need a log cleanup at here?).
> 
> I'm not sure.  Does your sda6 device support discards?  My VMs'
> SCRATCH_DEVs usually support it, and I noticed that all the other
> generic/ _log_writes_init tests set up a dm-thin volume so that the
> replays can always zero out the whole device before jumping to a
> snapshot.

No, it doesn't support discard, but it's multi-scripted:

# mkfs.xfs -f /dev/sda6
meta-data=/dev/sda6              isize=512    agcount=25, agsize=1064176 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=1, sparse=1, rmapbt=1
         =                       reflink=1    bigtime=1 inobtcount=1 nrext64=1
         =                       exchange=0  
data     =                       bsize=4096   blocks=26604400, imaxpct=25
         =                       sunit=16     swidth=32 blks
naming   =version 2              bsize=4096   ascii-ci=0, ftype=1, parent=0
log      =internal log           bsize=4096   blocks=179552, version=2
         =                       sectsz=512   sunit=16 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0

But you remind me, I remember Brian did below changes for dmlogwrites test.

fc5870da4 generic/470: use thin volume for dmlogwrites target device
3713a3b37 generic/457: use thin volume for dmlogwrites target device
96bcbcabd generic/455: use thin volume for dmlogwrites target device

commit 96bcbcabd0f34dcd57f9349c8eea09523d69a817
Author: Brian Foster <bfoster@redhat.com>
Date:   Tue Sep 1 09:47:26 2020 -0400

    generic/455: use thin volume for dmlogwrites target device
    
    dmlogwrites support for XFS depends on discard zeroing support of
    the intended target device. Update the test to use a thin volume and
    allow it to run consistently and reliably on XFS.

Thanks,
Zorro

> 
> --D
> 
> > Thanks,
> > Zorro
> > 
> > [1]
> > # ./check -s default generic/757
> > SECTION       -- default
> > FSTYP         -- xfs (non-debug)
> > PLATFORM      -- Linux/x86_64 dell-per750-41 6.12.0-0.rc7.58.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Nov 11 15:23:45 UTC 2024
> > MKFS_OPTIONS  -- -f /dev/sda6
> > MOUNT_OPTIONS -- -o context=system_u:object_r:root_t:s0 /dev/sda6 /mnt/scratch
> > 
> > generic/757 2185s ... [failed, exit status 1]- output mismatch (see /root/git/xfstests/results//default/generic/757.out.bad)
> >     --- tests/generic/757.out   2024-10-27 03:09:48.740518275 +0800
> >     +++ /root/git/xfstests/results//default/generic/757.out.bad 2024-11-15 03:06:59.462739215 +0800
> >     @@ -1,2 +1,5 @@
> >      QA output created by 757
> >     -Silence is golden
> >     +mount: /mnt/scratch: cannot mount; probably corrupted filesystem on /dev/sda6.
> >     +       dmesg(1) may have more information after failed mount system call.
> >     +mount -o context=system_u:object_r:root_t:s0 /dev/sda6 /mnt/scratch failed
> >     +(see /root/git/xfstests/results//default/generic/757.full for details)
> >     ...
> >     (Run 'diff -u /root/git/xfstests/tests/generic/757.out /root/git/xfstests/results//default/generic/757.out.bad'  to see the entire diff)
> > Ran: generic/757
> > Failures: generic/757
> > Failed 1 of 1 tests
> > 
> > [2]
> > Phase 1 - find and verify superblock...
> > Phase 2 - using internal log
> >         - zero log...
> > ERROR: The filesystem has valuable metadata changes in a log which needs to
> > be replayed.  Mount the filesystem to replay the log, and unmount it before
> > re-running xfs_repair.  If you are unable to mount the filesystem, then use
> > the -L option to destroy the log and attempt a repair.
> > Note that destroying the log may cause corruption -- please attempt a mount
> > of the filesystem before doing this.
> > 
> > > 
> > > --D
> > > 
> > > > > +		_scratch_unmount
> > > > > +	fi
> > > > 
> > > > 
> > > > >  	_check_scratch_fs
> > > > >  
> > > > >  	prev=$cur
> > > > > 
> > > > 
> > > > 
> > > 
> > 
> > 
> 


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2024-11-15 18:28 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-13  1:36 [PATCHSET] fstests: random fixes for v2024.10.28 Darrick J. Wong
2024-11-13  1:36 ` [PATCH 1/3] xfs/273: check thoroughness of the mappings Darrick J. Wong
2024-11-13  8:46   ` Christoph Hellwig
2024-11-15 10:13   ` Zorro Lang
2024-11-13  1:37 ` [PATCH 2/3] xfs/185: don't fail when rtfile is larger than rblocks Darrick J. Wong
2024-11-13  8:47   ` Christoph Hellwig
2024-11-15 10:13   ` Zorro Lang
2024-11-13  1:37 ` [PATCH 3/3] generic/757: fix various bugs in this test Darrick J. Wong
2024-11-13  8:48   ` Christoph Hellwig
2024-11-14  5:23   ` Zorro Lang
2024-11-14  5:30     ` Darrick J. Wong
2024-11-15  5:42       ` Zorro Lang
2024-11-15 17:30         ` Darrick J. Wong
2024-11-15 18:28           ` Zorro Lang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox