generic: test for file fsync after moving it to a new parent directory
[xfstests-dev.git] / tests / generic / 484
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 Red Hat Inc.  All Rights Reserved.
4 #
5 # FS QA Test 484
6 #
7 # POSIX requires that record locks are preserved across an execve(2). But
8 # there's bug that record locks are released if process is multithreaded at the
9 # time that execve is called.
10 #
11 # Fixed by patch from Jeff Layton:
12 # locks: change POSIX lock ownership on execve when files_struct is displaced
13 #
14 seq=`basename $0`
15 seqres=$RESULT_DIR/$seq
16 echo "QA output created by $seq"
17
18 here=`pwd`
19 tmp=/tmp/$$
20 status=1        # failure is the default!
21 trap "_cleanup; exit \$status" 0 1 2 3 15
22
23 _cleanup()
24 {
25         cd /
26         rm -f $tmp.*
27 }
28
29 # get standard environment, filters and checks
30 . ./common/rc
31 . ./common/filter
32
33 # remove previous $seqres.full before test
34 rm -f $seqres.full
35
36 # real QA test starts here
37 _supported_fs generic
38 _supported_os Linux
39 _require_test
40 _require_test_program "t_locks_execve"
41
42 # prepare a 4k testfile in TEST_DIR
43 $XFS_IO_PROG -f -c "pwrite -S 0xFF 0 4096" \
44         $TEST_DIR/t_lock_execve_file >> $seqres.full 2>&1
45
46 $here/src/t_locks_execve $TEST_DIR/t_lock_execve_file
47
48 # success, all done
49 echo "Silence is golden"
50 status=0
51 exit