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_scratch_shutdown
48 _scratch_mkfs >/dev/null 2>&1
49 _require_metadata_journaling $SCRATCH_DEV
50 _qmount_option "prjquota"
52 _require_prjquota $SCRATCH_DEV
55 testfile=$SCRATCH_MNT/testfile
63 if [ "$1" == "sync" ]; then
67 $XFS_IO_PROG -x -c "chproj 100" $testfile
69 before=`$XFS_IO_PROG -x -c "lsproj" $testfile`
71 $XFS_IO_PROG -f $testfile -c "fsync" | _filter_xfs_io
73 _scratch_shutdown | tee -a $seqres.full
76 after=`$XFS_IO_PROG -x -c "lsproj" $testfile`
78 # check inode's project quota id
79 if [ "$before" != "$after" ]; then
80 echo "Before: $before"
83 echo "Before: $before" >> $seqres.full
84 echo "After : $after" >> $seqres.full
90 echo "Silence is golden"