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 uid or gid changes, after we fsync that file, we can expect that
9 # uid/gid can be recovered after sudden power-cuts.
12 # 2. chown 100 testfile;
13 # 3. chgrp 100 testfile;
14 # 4. xfs_io -f testfile -c "fsync";
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
35 # get standard environment, filters and checks
39 # remove previous $seqres.full before test
42 # real QA test starts here
47 _require_scratch_shutdown
49 _scratch_mkfs >/dev/null 2>&1
50 _require_metadata_journaling $SCRATCH_DEV
52 testfile=$SCRATCH_MNT/testfile
53 stat_opt='-c "uid: %u, gid: %g"'
61 if [ "$1" == "sync" ]; then
68 before=`stat "$stat_opt" $testfile`
70 $XFS_IO_PROG -f $testfile -c "fsync" | _filter_xfs_io
72 _scratch_shutdown | tee -a $seqres.full
75 after=`stat "$stat_opt" $testfile`
77 # check inode's uid/gid
78 if [ "$before" != "$after" ]; then
79 echo "Before: $before"
82 echo "Before: $before" >> $seqres.full
83 echo "After : $after" >> $seqres.full
89 echo "Silence is golden"