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 _begin_fstest auto quick locks
16 # Override the default cleanup function.
24 # Import common functions.
27 # real QA test starts here
30 _require_command "$FLOCK_PROG" "flock"
32 # Create test file and find its inode NO.
33 testfile=$TEST_DIR/flock_testfile_$seq
35 tf_inode=$(stat -c %i $testfile)
36 echo inode $tf_inode >> $seqres.full
38 # Create new fd by exec
39 exec {test_fd}> $testfile
40 # flock locks the fd then exits, we should see the lock info even the owner is dead
42 cat /proc/locks >> $seqres.full
45 grep -q ":$tf_inode " /proc/locks || echo "lock info not found"
49 echo "Silence is golden"