2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2019 Huawei. All Rights Reserved.
7 # This testcase is trying to test recovery flow of generic filesystem,
8 # w/ below steps, once i_mode changes, after we fsync that file, we can
9 # expect that i_mode can be recovered after sudden power-cuts.
10 # 1. touch testfile or mkdir testdir
11 # 2. chmod 777 testfile/testdir
13 # 4. chmod 755 testfile/testdir
14 # 5. fsync testfile/testdir
15 # 6. record last i_mode
21 seqres=$RESULT_DIR/$seq
22 echo "QA output created by $seq"
26 status=1 # failure is the default!
27 trap "_cleanup; exit \$status" 0 1 2 3 15
36 # get standard environment, filters and checks
41 # remove previous $seqres.full before test
44 # real QA test starts here
48 _require_dm_target flakey
50 _scratch_mkfs >/dev/null 2>&1
51 _require_metadata_journaling $SCRATCH_DEV
54 testfile=$SCRATCH_MNT/testfile
55 testdir=$SCRATCH_MNT/testdir
64 if [ $is_dir = 1 ]; then
70 echo "Test chmod $target" >> $seqres.full
76 $XFS_IO_PROG $target -c "fsync"
78 local before=`stat -c %a $target`
80 _flakey_drop_and_remount
82 local after=`stat -c %a $target`
84 # check inode's i_mode
85 if [ "$before" != "$after" ]; then
86 echo "Before: $before"
90 if [ $is_dir = 1 ]; then
98 echo "Silence is golden"