From: Xiong Murphy Zhou <xzhou@redhat.com>
To: fstests@vger.kernel.org
Cc: Xiong Murphy Zhou <xzhou@redhat.com>
Subject: [PATCH] generic: add test for checking /proc/locks after exec and flock
Date: Thu, 9 Aug 2018 15:53:53 +0800 [thread overview]
Message-ID: <20180809075353.31514-1-xzhou@redhat.com> (raw)
Regression test case for kernel patch:
fs/lock: show locks info owned by dead/invisible processes
Open new fd by exec shell built-in, then require exclusive lock
by flock(1) command. Checking /proc/locks for the lock info.
This patchset post by Konstantin Khorenko <khorenko@virtuozzo.com>
has not been merged v4.18-rc8.
Signed-off-by: Xiong Murphy Zhou <xzhou@redhat.com>
---
tests/generic/504 | 58 +++++++++++++++++++++++++++++++++++++++++++
tests/generic/504.out | 2 ++
tests/generic/group | 1 +
3 files changed, 61 insertions(+)
create mode 100755 tests/generic/504
create mode 100644 tests/generic/504.out
diff --git a/tests/generic/504 b/tests/generic/504
new file mode 100755
index 00000000..b77f1d60
--- /dev/null
+++ b/tests/generic/504
@@ -0,0 +1,58 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2018 RedHat Inc. All Rights Reserved.
+#
+# FS QA Test 504
+#
+# Regression test case for kernel patch:
+# fs/lock: show locks info owned by dead/invisible processes
+#
+# Open new fd by exec shell built-in, then require exclusive lock
+# by flock(1) command. Checking /proc/locks for the lock info.
+#
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1 # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+ cd /
+ rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs generic
+_supported_os Linux
+_require_test
+
+# Create test file and find its inode NO.
+touch $TEST_DIR/flock_testfile
+tf_inode=$(stat -c %i $TEST_DIR/flock_testfile)
+echo inode $tf_inode >> $seqres.full
+
+# Create new fd by exec and lock.
+exec 9> $TEST_DIR/flock_testfile
+flock -x 9
+cat /proc/locks >> $seqres.full
+
+# Checking
+grep -qw $tf_inode /proc/locks || echo "lock info not found"
+
+# success, all done
+status=0
+echo "Silence is golden"
+exit
diff --git a/tests/generic/504.out b/tests/generic/504.out
new file mode 100644
index 00000000..d46394b8
--- /dev/null
+++ b/tests/generic/504.out
@@ -0,0 +1,2 @@
+QA output created by 504
+Silence is golden
diff --git a/tests/generic/group b/tests/generic/group
index 79a5705a..55155de8 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -506,3 +506,4 @@
501 auto quick clone log
502 auto quick log
503 auto quick dax punch collapse zero
+504 auto quick locks
--
2.17.0.252.gfe0a9ea
reply other threads:[~2018-08-09 10:17 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180809075353.31514-1-xzhou@redhat.com \
--to=xzhou@redhat.com \
--cc=fstests@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox