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 _begin_fstest shutdown auto quick metadata
23 # Import common functions.
26 # real QA test starts here
30 _require_scratch_shutdown
32 _scratch_mkfs >/dev/null 2>&1
33 _require_metadata_journaling $SCRATCH_DEV
35 testfile=$SCRATCH_MNT/testfile
36 stat_opt='-c "uid: %u, gid: %g"'
44 if [ "$1" == "sync" ]; then
51 before=`stat "$stat_opt" $testfile`
53 $XFS_IO_PROG -f $testfile -c "fsync" | _filter_xfs_io
55 _scratch_shutdown | tee -a $seqres.full
58 after=`stat "$stat_opt" $testfile`
60 # check inode's uid/gid
61 if [ "$before" != "$after" ]; then
62 echo "Before: $before"
65 echo "Before: $before" >> $seqres.full
66 echo "After : $after" >> $seqres.full
72 echo "Silence is golden"