]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
xfs/242: fix test failure due to incorrect filtering in _filter_bmap
authorLong Li <leo.lilong@huawei.com>
Fri, 12 Jul 2024 06:47:16 +0000 (14:47 +0800)
committerZorro Lang <zlang@kernel.org>
Fri, 12 Jul 2024 19:05:34 +0000 (03:05 +0800)
I got a failure in xfs/242 as follows, it can be easily reproduced
when I run xfs/242 as a cyclic test.

  13. data -> unwritten -> data
  0: [0..127]: data
  -1: [128..511]: unwritten
  -2: [512..639]: data
  +1: [128..639]: unwritten

The root cause, as Dave pointed out in previous email [1], is that
_filter_bmap may incorrectly match the AG-OFFSET in column 5 for datadev
files. On the other hand, _filter_bmap missing a "next" to jump out when
it matches "data" in the 5th column, otherwise it might print the result
twice. The issue was introduced by commit 7d5d3f77154e ("xfs/242: fix
_filter_bmap for xfs_io bmap that does rt file properly"). The failure
disappeared when I retest xfs/242 by reverted commit 7d5d3f77154e.

Fix it by matching the 7th column first and then the 5th column in
_filter_bmap, because the rtdev file only has 5 columns in the `bmap -vp`
output.

[1] https://lore.kernel.org/all/Zh9UkHEesvrpSQ7J@dread.disaster.area/

Signed-off-by: Long Li <leo.lilong@huawei.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/punch

index 9e730404e24a2a3a4e4ac47c5b00b2fa155fe4b0..43ccab69feb0de99d2045d4a7105f61898661d94 100644 (file)
@@ -188,7 +188,10 @@ _filter_hole_fiemap()
        _coalesce_extents
 }
 
-# Column 7 for datadev files and column 5 for rtdev files
+# Column 7 for datadev files and column 5 for rtdev files, To prevent the
+# 5th column in datadev files from being potentially matched incorrectly,
+# we need to match Column 7 for datadev files first, because the rtdev
+# file only has 5 columns in the `bmap -vp` output.
 #     10000 Unwritten preallocated extent
 #     01000 Doesn't begin on stripe unit
 #     00100 Doesn't end   on stripe unit
@@ -201,18 +204,19 @@ _filter_bmap()
                        print $1, $2, $3;
                        next;
                }
-               $5 ~ /1[01][01][01][01]/ {
+               $7 ~ /1[01][01][01][01]/ {
                        print $1, $2, "unwritten";
                        next;
                }
-               $5 ~ /0[01][01][01][01]/ {
+               $7 ~ /0[01][01][01][01]/ {
                        print $1, $2, "data"
+                       next;
                }
-               $7 ~ /1[01][01][01][01]/ {
+               $5 ~ /1[01][01][01][01]/ {
                        print $1, $2, "unwritten";
                        next;
                }
-               $7 ~ /0[01][01][01][01]/ {
+               $5 ~ /0[01][01][01][01]/ {
                        print $1, $2, "data"
                }' |
        _coalesce_extents