fstests.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfs/126: fix that corrupt xattr might fail with a small probability
@ 2020-01-08  9:27 yu kuai
  2020-01-08 16:22 ` Darrick J. Wong
  0 siblings, 1 reply; 10+ messages in thread
From: yu kuai @ 2020-01-08  9:27 UTC (permalink / raw)
  To: guaneryu, darrick.wong
  Cc: jbacik, fstests, linux-xfs, yukuai3, zhengbin13, yi.zhang

The cmd used in xfs_db to corrupt xattr is "blocktrash -x 32
-y $((blksz * 8)) -n8 -3", which means select random 8 bit from 32 to
end of the block, and the changed bits are randomized. However,
there is a small chance that corrupting xattr failed because irrelevant
bits are chossen or the chooosen bits are not changed, which lead to
output missmatch:
QA output created by 126                    QA output created by 126
+ create scratch fs                         + create scratch fs
+ mount fs image                            + mount fs image
+ make some files                           + make some files
+ check fs                                  + check fs
+ check xattr                               + check xattr
+ corrupt xattr                             + corrupt xattr
+ mount image && modify xattr               + mount image && modify xattr
+ repair fs                                 + repair fs
+ mount image (2)                           + mount image (2)
+ chattr -R -i                              + chattr -R -i
+ modify xattr (2)                          + modify xattr (2)
                                            > # file: tmp/scratch/attrfile
                                            > user.x00000000="0000000000000000"
                                            >
+ check fs (2)                              + check fs (2)

Fix the problem by adding a seed for random processing to select same
bits each time, and inverting the selected bits.

Signed-off-by: yu kuai <yukuai3@huawei.com>
---
 tests/xfs/126 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/xfs/126 b/tests/xfs/126
index 4f9f8cf9..9b57e58b 100755
--- a/tests/xfs/126
+++ b/tests/xfs/126
@@ -37,7 +37,7 @@ test -n "${FORCE_FUZZ}" || _require_scratch_xfs_crc
 _require_attrs
 _require_populate_commands
 _require_xfs_db_blocktrash_z_command
-test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -3"
+test -z "${FUZZ_ARGS}" && FUZZ_ARGS="-n 8 -2"
 
 rm -f $seqres.full
 
@@ -72,7 +72,7 @@ echo "+ corrupt xattr"
 loff=1
 while true; do
 	_scratch_xfs_db -x -c "inode ${inode}" -c "ablock ${loff}" -c "stack" | grep -q 'file attr block is unmapped' && break
-	_scratch_xfs_db -x -c "inode ${inode}" -c "ablock ${loff}" -c "stack" -c "blocktrash -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
+	_scratch_xfs_db -x -c "inode ${inode}" -c "ablock ${loff}" -c "stack" -c "blocktrash -s 1024 -x 32 -y $((blksz * 8)) -z ${FUZZ_ARGS}" >> $seqres.full
 	loff="$((loff + 1))"
 done
 
-- 
2.17.2


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

end of thread, other threads:[~2020-01-17  6:18 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-08  9:27 [PATCH] xfs/126: fix that corrupt xattr might fail with a small probability yu kuai
2020-01-08 16:22 ` Darrick J. Wong
2020-01-09  3:56   ` yukuai (C)
2020-01-09  4:00   ` yukuai (C)
2020-01-09 16:46     ` Darrick J. Wong
2020-01-16 12:22       ` yukuai (C)
2020-01-16 16:03         ` Darrick J. Wong
2020-01-17  2:20           ` yukuai (C)
2020-01-17  3:10             ` yukuai (C)
2020-01-17  6:15               ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).