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
49 _require_dm_target flakey
51 _scratch_mkfs >/dev/null 2>&1
52 _require_metadata_journaling $SCRATCH_DEV
55 testfile=$SCRATCH_MNT/testfile
56 testdir=$SCRATCH_MNT/testdir
65 if [ $is_dir = 1 ]; then
71 echo "Test chmod $target" >> $seqres.full
77 $XFS_IO_PROG $target -c "fsync"
79 local before=`stat -c %a $target`
81 _flakey_drop_and_remount
83 local after=`stat -c %a $target`
85 # check inode's i_mode
86 if [ "$before" != "$after" ]; then
87 echo "Before: $before"
91 if [ $is_dir = 1 ]; then
99 echo "Silence is golden"