blob: da9dc5b6df2ef1efb322efc70799a4dbb3fca811 (
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
|
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2023 Jan Kara, SUSE Linux. All Rights Reserved.
#
# FS QA Test 707
#
# This is a test verifying whether the filesystem can gracefully handle
# modifying of a directory while it is being moved, in particular the cases
# where directory format changes
#
. ./common/preamble
_begin_fstest auto
_supported_fs generic
_require_scratch
_fixed_by_kernel_commit f950fd052913 \
"udf: Protect rename against modification of moved directory"
_fixed_by_kernel_commit 0813299c586b \
"ext4: Fix possible corruption when moving a directory"
_scratch_mkfs >>$seqres.full 2>&1
_scratch_mount
_cleanup()
{
cd /
rm -f $tmp.*
if [ -n "$BGPID" ]; then
# Stop background process
kill -9 $BGPID &>/dev/null
wait
fi
}
# Loop multiple times trying to hit the race
loops=$((100*TIME_FACTOR))
files=500
moves=500
create_files()
{
# We use slightly longer file name to make directory grow faster and
# hopefully convert between various types
for (( i = 0; i < $files; i++ )); do
touch somewhatlongerfilename$i
done
}
for (( i = 0; i <= $moves; i++ )); do
mkdir $SCRATCH_MNT/dir$i
done
for (( l = 0; l < $loops; l++ )); do
mkdir $SCRATCH_MNT/dir0/dir
pushd $SCRATCH_MNT/dir0/dir &>/dev/null
create_files &
BGPID=$!
popd &>/dev/null
for (( i = 0; i < $moves; i++ )); do
mv $SCRATCH_MNT/dir$i/dir $SCRATCH_MNT/dir$((i+1))/dir
done
wait
unset BGPID
rm -r $SCRATCH_MNT/dir$moves/dir
done
echo "Silence is golden"
status=0
exit
|