aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChandan Babu R <chandanbabu@kernel.org>2024-01-11 17:28:25 +0530
committerZorro Lang <zlang@kernel.org>2024-01-14 20:39:09 +0800
commite443cadcea483baa4718e5dce8c221d185d5d076 (patch)
tree2f820e146e7fdaa5558663d9d9a559a55adddb68
parentab0c766d2017b89809dcb1194c3f77baa6c060be (diff)
downloadxfstests-dev-e443cadcea483baa4718e5dce8c221d185d5d076.tar.gz
common/xfs: Do not append -a and -o options to metadump
xfs/253 requires the metadump to be obfuscated. However _xfs_metadump() would append the '-o' option causing the metadump to be unobfuscated. This commit fixes the bug by modifying _xfs_metadump() to no longer append any metadump options. The direct/indirect callers of this function now pass the required options explicitly. Reviewed-by: "Darrick J. Wong" <djwong@kernel.org> Signed-off-by: Chandan Babu R <chandanbabu@kernel.org> Signed-off-by: Zorro Lang <zlang@kernel.org>
-rw-r--r--common/populate2
-rw-r--r--common/xfs7
-rwxr-xr-xtests/xfs/2912
-rwxr-xr-xtests/xfs/3362
-rwxr-xr-xtests/xfs/4322
-rwxr-xr-xtests/xfs/5032
6 files changed, 8 insertions, 9 deletions
diff --git a/common/populate b/common/populate
index 3d233073c9..cfbfd88a7f 100644
--- a/common/populate
+++ b/common/populate
@@ -55,7 +55,7 @@ __populate_fail() {
case "$FSTYP" in
xfs)
_scratch_unmount
- _scratch_xfs_metadump "$metadump"
+ _scratch_xfs_metadump "$metadump" -a -o
;;
ext4)
_scratch_unmount
diff --git a/common/xfs b/common/xfs
index f23e1e9187..91b8ac387c 100644
--- a/common/xfs
+++ b/common/xfs
@@ -677,7 +677,6 @@ _xfs_metadump() {
local compressopt="$4"
shift; shift; shift; shift
local options="$@"
- test -z "$options" && options="-a -o"
if [ "$logdev" != "none" ]; then
options="$options -l $logdev"
@@ -865,7 +864,7 @@ _check_xfs_filesystem()
if [ "$ok" -ne 1 ] && [ "$DUMP_CORRUPT_FS" = "1" ]; then
local flatdev="$(basename "$device")"
_xfs_metadump "$seqres.$flatdev.check.md" "$device" "$logdev" \
- compress >> $seqres.full
+ compress -a -o >> $seqres.full
fi
# Optionally test the index rebuilding behavior.
@@ -898,7 +897,7 @@ _check_xfs_filesystem()
if [ "$rebuild_ok" -ne 1 ] && [ "$DUMP_CORRUPT_FS" = "1" ]; then
local flatdev="$(basename "$device")"
_xfs_metadump "$seqres.$flatdev.rebuild.md" "$device" \
- "$logdev" compress >> $seqres.full
+ "$logdev" compress -a -o >> $seqres.full
fi
fi
@@ -982,7 +981,7 @@ _check_xfs_filesystem()
if [ "$orebuild_ok" -ne 1 ] && [ "$DUMP_CORRUPT_FS" = "1" ]; then
local flatdev="$(basename "$device")"
_xfs_metadump "$seqres.$flatdev.orebuild.md" "$device" \
- "$logdev" compress >> $seqres.full
+ "$logdev" compress -a -o >> $seqres.full
fi
fi
diff --git a/tests/xfs/291 b/tests/xfs/291
index 600dcb2eba..54448497cc 100755
--- a/tests/xfs/291
+++ b/tests/xfs/291
@@ -92,7 +92,7 @@ _scratch_xfs_check >> $seqres.full 2>&1 || _fail "xfs_check failed"
# Yes they can! Now...
# Can xfs_metadump cope with this monster?
-_scratch_xfs_metadump $tmp.metadump || _fail "xfs_metadump failed"
+_scratch_xfs_metadump $tmp.metadump -a -o || _fail "xfs_metadump failed"
SCRATCH_DEV=$tmp.img _scratch_xfs_mdrestore $tmp.metadump || _fail "xfs_mdrestore failed"
SCRATCH_DEV=$tmp.img _scratch_xfs_repair -f &>> $seqres.full || \
_fail "xfs_repair of metadump failed"
diff --git a/tests/xfs/336 b/tests/xfs/336
index d7a074d971..43b3790cbb 100755
--- a/tests/xfs/336
+++ b/tests/xfs/336
@@ -62,7 +62,7 @@ _scratch_cycle_mount
echo "Create metadump file"
_scratch_unmount
-_scratch_xfs_metadump $metadump_file
+_scratch_xfs_metadump $metadump_file -a
# Now restore the obfuscated one back and take a look around
echo "Restore metadump"
diff --git a/tests/xfs/432 b/tests/xfs/432
index 66315b0398..dae68fb2dd 100755
--- a/tests/xfs/432
+++ b/tests/xfs/432
@@ -86,7 +86,7 @@ echo "qualifying extent: $extlen blocks" >> $seqres.full
test -n "$extlen" || _notrun "could not create dir extent > 1000 blocks"
echo "Try to metadump"
-_scratch_xfs_metadump $metadump_file -w
+_scratch_xfs_metadump $metadump_file -a -o -w
SCRATCH_DEV=$metadump_img _scratch_xfs_mdrestore $metadump_file
echo "Check restored metadump image"
diff --git a/tests/xfs/503 b/tests/xfs/503
index f5710ece35..8805632d4f 100755
--- a/tests/xfs/503
+++ b/tests/xfs/503
@@ -46,7 +46,7 @@ metadump_file_ag=${metadump_file}.ag
copy_file=$testdir/copy.img
echo metadump
-_scratch_xfs_metadump $metadump_file >> $seqres.full
+_scratch_xfs_metadump $metadump_file -a -o >> $seqres.full
echo metadump a
_scratch_xfs_metadump $metadump_file_a -a >> $seqres.full