blob: 3b7347425e8fd7953ce9ed494fad8bb07ebaa3cf (
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
|
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2019 Huawei. All Rights Reserved.
#
# FS QA Test 535
#
# This testcase is trying to test recovery flow of generic filesystem,
# w/ below steps, once i_mode changes, after we fsync that file, we can
# expect that i_mode can be recovered after sudden power-cuts.
# 1. touch testfile or mkdir testdir
# 2. chmod 777 testfile/testdir
# 3. sync
# 4. chmod 755 testfile/testdir
# 5. fsync testfile/testdir
# 6. record last i_mode
# 7. flakey drop
# 8. remount
# 9. check i_mode
#
. ./common/preamble
_begin_fstest auto quick log
# Override the default cleanup function.
_cleanup()
{
_cleanup_flakey
cd /
rm -f $tmp.*
}
# Import common functions.
. ./common/filter
. ./common/dmflakey
# real QA test starts here
_supported_fs generic
_require_scratch
_require_dm_target flakey
_scratch_mkfs >/dev/null 2>&1
_require_metadata_journaling $SCRATCH_DEV
_init_flakey
testfile=$SCRATCH_MNT/testfile
testdir=$SCRATCH_MNT/testdir
do_check()
{
local target=$1
local is_dir=$2
_mount_flakey
if [ $is_dir = 1 ]; then
mkdir $target
else
touch $target
fi
echo "Test chmod $target" >> $seqres.full
chmod 777 $target
sync
chmod 755 $target
$XFS_IO_PROG $target -c "fsync"
local before=`stat -c %a $target`
_flakey_drop_and_remount
local after=`stat -c %a $target`
# check inode's i_mode
if [ "$before" != "$after" ]; then
echo "Before: $before"
echo "After : $after"
fi
if [ $is_dir = 1 ]; then
rmdir $target
else
rm -f $target
fi
_unmount_flakey
}
echo "Silence is golden"
do_check $testfile 0
do_check $testdir 1
status=0
exit
|