4 # Test that calling fsync against a file using the merged directory does not
5 # result in a crash nor fails unexpectedly.
7 # This is motivated by a change in overlayfs that resulted in a crash (invalid
8 # memory access) when the lower or upper directory belonged to a btrfs file
11 #-----------------------------------------------------------------------
13 # Copyright (C) 2016 SUSE Linux Products GmbH. All Rights Reserved.
14 # Author: Filipe Manana <fdmanana@suse.com>
16 # This program is free software; you can redistribute it and/or
17 # modify it under the terms of the GNU General Public License as
18 # published by the Free Software Foundation.
20 # This program is distributed in the hope that it would be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # GNU General Public License for more details.
25 # You should have received a copy of the GNU General Public License
26 # along with this program; if not, write the Free Software Foundation,
27 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 #-----------------------------------------------------------------------
32 seqres=$RESULT_DIR/$seq
33 echo "QA output created by $seq"
37 status=1 # failure is the default!
38 trap "_cleanup; exit \$status" 0 1 2 3 15
46 # get standard environment, filters and checks
50 # remove previous $seqres.full before test
53 # real QA test starts here
58 # Remove all files from previous tests
61 # Create our test file.
62 lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
64 touch $lowerdir/foobar
68 # Write some data to our file and fsync it, using the merged directory path.
69 # This should work and not result in a crash.
70 $XFS_IO_PROG -c "pwrite 0 64k" -c "fsync" $SCRATCH_MNT/foobar | _filter_xfs_io