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 _begin_fstest auto quick log
23 # Override the default cleanup function.
31 # Import common functions.
35 # real QA test starts here
39 _require_dm_target flakey
41 _scratch_mkfs >/dev/null 2>&1
42 _require_metadata_journaling $SCRATCH_DEV
45 testfile=$SCRATCH_MNT/testfile
46 testdir=$SCRATCH_MNT/testdir
55 if [ $is_dir = 1 ]; then
61 echo "Test chmod $target" >> $seqres.full
67 $XFS_IO_PROG $target -c "fsync"
69 local before=`stat -c %a $target`
71 _flakey_drop_and_remount
73 local after=`stat -c %a $target`
75 # check inode's i_mode
76 if [ "$before" != "$after" ]; then
77 echo "Before: $before"
81 if [ $is_dir = 1 ]; then
89 echo "Silence is golden"