2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2018 RedHat Inc. All Rights Reserved.
7 # Regression test case for kernel patch:
8 # fs/lock: skip lock owner pid translation in case we are in init_pid_ns
10 # Open new fd by exec shell built-in, then require exclusive lock
11 # by flock(1) command. Checking /proc/locks for the lock info.
14 seqres=$RESULT_DIR/$seq
15 echo "QA output created by $seq"
19 status=1 # failure is the default!
20 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
40 _require_command "$FLOCK_PROG" "flock"
42 # Create test file and find its inode NO.
43 testfile=$TEST_DIR/flock_testfile_$seq
45 tf_inode=$(stat -c %i $testfile)
46 echo inode $tf_inode >> $seqres.full
48 # Create new fd by exec
49 exec {test_fd}> $testfile
50 # flock locks the fd then exits, we should see the lock info even the owner is dead
52 cat /proc/locks >> $seqres.full
55 grep -q ":$tf_inode " /proc/locks || echo "lock info not found"
59 echo "Silence is golden"