Skip to contentSkip to conversation

generic: add fcntl corner cases tests

RFC New Alexander Aring 1 participant 1 message Aug 9, 2023

lore
Share & tools
lore
#0 lore raw

RFC 1/1 generic: add fcntl corner cases tests

This patch adds generic 730 testcase. It will test on various fcntl() corner cases that was making problems on a GFS2 filesystem. GFS2 has it's own lock() implementation that has it's own posix lock implementation behind it. There are testcases to find issues with struct file_lock matches. Currently the Linux kernel does not have a unique identifier per lock request to e.g. find the original lock request when a complete handler of an async lock request comes back. The current way is to use struct file_lock fields to fine the original lock request. However there was issues being found that in some cases it wasn't an unique match because multiple pending struct file_lock could have the same state. To find issues the testcases fcntl_lock_equal_file_lock and fcntl_lock_same_owner are introduced and their OFD variants.

Other test like fcntl_lock_kill_child tests cleanup routines when a process blocking in F_SETLKW to wait the lock request getting granted and the process gets killed.

A similar test is fcntl_lock_signal_interrupt which checks for side-effects e.g. unlock all previous acquired locks when a blocking F_SETLKW gets interrupted by a signal.

---
 src/Makefile                         |   5 +-
 src/fcntl_lock_equal_file_lock.c     | 140 +++++++++++++++++++++++
 src/fcntl_lock_equal_file_lock_ofd.c | 144 ++++++++++++++++++++++++
 src/fcntl_lock_kill_child.c          | 148 +++++++++++++++++++++++++
 src/fcntl_lock_same_owner.c          | 146 ++++++++++++++++++++++++
 src/fcntl_lock_same_owner_ofd.c      | 144 ++++++++++++++++++++++++
 src/fcntl_lock_signal_interrupt.c    | 159 +++++++++++++++++++++++++++
 tests/generic/730                    |  70 ++++++++++++
 tests/generic/730.out                |   2 +
 9 files changed, 957 insertions(+), 1 deletion(-)
 create mode 100644 src/fcntl_lock_equal_file_lock.c
 create mode 100644 src/fcntl_lock_equal_file_lock_ofd.c
 create mode 100644 src/fcntl_lock_kill_child.c
 create mode 100644 src/fcntl_lock_same_owner.c
 create mode 100644 src/fcntl_lock_same_owner_ofd.c
 create mode 100644 src/fcntl_lock_signal_interrupt.c
 create mode 100755 tests/generic/730
 create mode 100644 tests/generic/730.out
src/Makefile +4 -1
index 24cd4747..e633f748 100644
@@ -19,7 +19,10 @@ TARGETS = dirstress fill fill2 getpagesize holes lstat64 \
 	t_ofd_locks t_mmap_collision mmap-write-concurrent \
 	t_get_file_time t_create_short_dirs t_create_long_dirs t_enospc \
 	t_mmap_writev_overlap checkpoint_journal mmap-rw-fault allocstale \
-	t_mmap_cow_memory_failure fake-dump-rootino dio-buf-fault
+	t_mmap_cow_memory_failure fake-dump-rootino dio-buf-fault \
+	fcntl_lock_equal_file_lock fcntl_lock_equal_file_lock_ofd \
+	fcntl_lock_kill_child fcntl_lock_same_owner fcntl_lock_same_owner_ofd \
+	fcntl_lock_signal_interrupt
 
 LINUX_TARGETS = xfsctl bstat t_mtab getdevicesize preallo_rw_pattern_reader \
 	preallo_rw_pattern_writer ftrunc trunc fs_perms testx looptest \
src/fcntl_lock_equal_file_lock.c new file +140 -0

140 lines not on this page · raw message

src/fcntl_lock_equal_file_lock_ofd.c new file +144 -0

144 lines not on this page · raw message

src/fcntl_lock_kill_child.c new file +148 -0

148 lines not on this page · raw message

src/fcntl_lock_same_owner.c new file +146 -0

146 lines not on this page · raw message

src/fcntl_lock_same_owner_ofd.c new file +144 -0

144 lines not on this page · raw message

src/fcntl_lock_signal_interrupt.c new file +159 -0

159 lines not on this page · raw message

tests/generic/730 new file +70 -0

70 lines not on this page · raw message

tests/generic/730.out new file +2 -0
new file mode 100644
index 00000000..50c3c832
@@ -0,0 +1,2 @@
+QA output created by 730
+Silence is golden
Signature · 1 line
2.31.1