2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Chengguang Xu <cgxu519@icloud.com>
7 # Inspired by syncfs bug of overlayfs which does not sync dirty inodes in
8 # underlying filesystem.
10 # Create a small file then run syncfs and shutdown filesystem(or underlying
11 # filesystem of overlayfs) to check syncfs result.
13 # Test will be skipped if filesystem(or underlying filesystem of overlayfs)
14 # does not support shutdown.
17 seqres=$RESULT_DIR/$seq
18 echo "QA output created by $seq"
23 trap "_cleanup; exit \$status" 0 1 2 3 15
31 # get standard environment, filters and checks
35 # remove previous $seqres.full before test
38 # real QA test starts here
44 _require_scratch_shutdown
45 _require_xfs_io_command "syncfs"
47 _scratch_mkfs >/dev/null 2>&1
50 # Background writeback will flush dirty inode by dirty ratio and dirty time
51 # period(default 30 seconds), in order to avoid interference from it,
52 # run sync before test to make all dirty inodes clean, and it also
53 # accelerates syncfs on testing filesystem so that test case can finish
58 $XFS_IO_PROG -f -c "pwrite 0 4K" $SCRATCH_MNT/testfile >/dev/null 2>&1
60 # fssum used for comparing checksum of test file(data & metedata),
61 # exclude checking about atime, block structure, open error.
62 $FSSUM_PROG -ugomAcdES -f -w $tmp.fssum $SCRATCH_MNT
63 $XFS_IO_PROG -c "syncfs" $SCRATCH_MNT/testfile >/dev/null 2>&1
66 $FSSUM_PROG -r $tmp.fssum $SCRATCH_MNT