2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Red Hat Inc. All Rights Reserved.
7 # When file in lower dir is locked and it's been copied up,
8 # make sure the lock is working in overlayfs.
10 # Kernel commit below fixed it.
11 # c568d68341be locks: fix file locking on overlayfs
13 # This reproducer was originally written by
14 # Miklos Szeredi <mszeredi@redhat.com>
17 seqres=$RESULT_DIR/$seq
18 echo "QA output created by $seq"
22 status=1 # failure is the default!
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
40 # Modify as appropriate.
43 _require_command "$FLOCK_PROG" flock
45 # Remove all files from previous tests
48 lowerdir=$OVL_BASE_SCRATCH_MNT/$OVL_LOWER
55 # Testing copyup and flock
56 flock $SCRATCH_MNT/foo sleep 3 &
57 # flock in subshell should fail with no output
58 (sleep 1; echo bar > $SCRATCH_MNT/foo; \
59 flock -n $SCRATCH_MNT/foo echo LOCKED)
62 echo "Silence is golden"