2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2016 SUSE Linux Products GmbH. All Rights Reserved.
7 # Test that calling fsync against a file using the merged directory does not
8 # result in a crash nor fails unexpectedly.
10 # This is motivated by a change in overlayfs that resulted in a crash (invalid
11 # memory access) when the lower or upper directory belonged to a btrfs file
15 seqres=$RESULT_DIR/$seq
16 echo "QA output created by $seq"
20 status=1 # failure is the default!
21 trap "_cleanup; exit \$status" 0 1 2 3 15
29 # get standard environment, filters and checks
33 # remove previous $seqres.full before test
36 # real QA test starts here
41 # Remove all files from previous tests
44 # Create our test file.
45 lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
47 touch $lowerdir/foobar
51 # Write some data to our file and fsync it, using the merged directory path.
52 # This should work and not result in a crash.
53 $XFS_IO_PROG -c "pwrite 0 64k" -c "fsync" $SCRATCH_MNT/foobar | _filter_xfs_io