blob: 760cd8617f2c0c1c2b9e474a95f08845871c072f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2023 Oracle. All Rights Reserved.
#
# FS QA Test No. 598
#
# Make sure that metadump obfuscation works for filesystems with ascii-ci
# enabled.
#
. ./common/preamble
_begin_fstest auto dir ci
_cleanup()
{
cd /
rm -r -f $tmp.* $testdir
}
_fixed_by_git_commit xfsprogs 10a01bcd \
"xfs_db: fix metadump name obfuscation for ascii-ci filesystems"
_fixed_by_kernel_commit a9248538facc \
"xfs: stabilize the dirent name transformation function used for ascii-ci dir hash computation"
_fixed_by_kernel_commit 9dceccc5822f \
"xfs: use the directory name hash function for dir scrubbing"
_supported_fs xfs
_require_test
_require_scratch
_require_xfs_mkfs_ciname
_scratch_mkfs -n version=ci > $seqres.full
_scratch_mount
# Create a two-block directory to force leaf format
mkdir "$SCRATCH_MNT/lol"
touch "$SCRATCH_MNT/lol/autoexec.bat"
i=0
dblksz=$(_xfs_get_dir_blocksize "$SCRATCH_MNT")
nr_dirents=$((dblksz * 2 / 256))
for ((i = 0; i < nr_dirents; i++)); do
name="$(printf "y%0254d" $i)"
ln "$SCRATCH_MNT/lol/autoexec.bat" "$SCRATCH_MNT/lol/$name"
done
dirsz=$(stat -c '%s' $SCRATCH_MNT/lol)
test $dirsz -gt $dblksz || echo "dir size $dirsz, expected at least $dblksz?"
stat $SCRATCH_MNT/lol >> $seqres.full
# Create a two-block attr to force leaf format
i=0
for ((i = 0; i < nr_dirents; i++)); do
name="$(printf "user.%0250d" $i)"
$SETFATTR_PROG -n "$name" -v 1 "$SCRATCH_MNT/lol/autoexec.bat"
done
stat $SCRATCH_MNT/lol/autoexec.bat >> $seqres.full
_scratch_unmount
testdir=$TEST_DIR/$seq.metadumps
mkdir -p $testdir
metadump_file=$testdir/scratch.md
metadump_file_a=${metadump_file}.a
metadump_file_o=${metadump_file}.o
metadump_file_ao=${metadump_file}.ao
echo metadump
_scratch_xfs_metadump $metadump_file >> $seqres.full
echo metadump a
_scratch_xfs_metadump $metadump_file_a -a >> $seqres.full
echo metadump o
_scratch_xfs_metadump $metadump_file_o -o >> $seqres.full
echo metadump ao
_scratch_xfs_metadump $metadump_file_ao -a -o >> $seqres.full
echo mdrestore
_scratch_xfs_mdrestore $metadump_file
_scratch_mount
_check_scratch_fs
_scratch_unmount
echo mdrestore a
_scratch_xfs_mdrestore $metadump_file_a
_scratch_mount
_check_scratch_fs
_scratch_unmount
echo mdrestore o
_scratch_xfs_mdrestore $metadump_file_o
_scratch_mount
_check_scratch_fs
_scratch_unmount
echo mdrestore ao
_scratch_xfs_mdrestore $metadump_file_ao
_scratch_mount
_check_scratch_fs
_scratch_unmount
# success, all done
status=0
exit
|