2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Huawei. All Rights Reserved.
7 # This testcase is trying to test recovery flow of generic filesystem, w/ below
8 # steps, once project id changes, after we fsync that file, we can expect that
9 # project id can be recovered after sudden power-cuts.
12 # 2. chattr -p 100 testfile;
13 # 3. xfs_io -f testfile -c "fsync";
20 seqres=$RESULT_DIR/$seq
21 echo "QA output created by $seq"
25 status=1 # failure is the default!
26 trap "_cleanup; exit \$status" 0 1 2 3 15
34 # get standard environment, filters and checks
39 # remove previous $seqres.full before test
42 # real QA test starts here
46 _require_command "$LSATTR_PROG" lsattr
47 _require_command "$CHATTR_PROG" chattr
50 _require_scratch_shutdown
52 _scratch_mkfs >/dev/null 2>&1
53 _require_metadata_journaling $SCRATCH_DEV
54 _require_prjquota $SCRATCH_DEV
56 testfile=$SCRATCH_MNT/testfile
64 if [ "$1" == "sync" ]; then
68 $CHATTR_PROG -p 100 $testfile
70 before=`$LSATTR_PROG -p $testfile`
72 $XFS_IO_PROG -f $testfile -c "fsync" | _filter_xfs_io
74 _scratch_shutdown | tee -a $seqres.full
77 after=`$LSATTR_PROG -p $testfile`
79 # check inode's project quota id
80 if [ "$before" != "$after" ]; then
81 echo "Before: $before"
84 echo "Before: $before" >> $seqres.full
85 echo "After : $after" >> $seqres.full
91 echo "Silence is golden"