[LTP] [PATCH 6/9] syscalls/fanotify10: Use dedicated mark type for inode mark on parent

Amir Goldstein amir73il@gmail.com
Mon Sep 5 17:42:36 CEST 2022


This highlights the test cases that use a directory inode mark on parent
in contrast to the test cases that use non-dir inode marks.

One test case that uses DIR_MNT2 for no reason (there are no mount marks
in this test case) was changed to use the standard DIR_PATH.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
 testcases/kernel/syscalls/fanotify/fanotify.h |  3 +++
 .../kernel/syscalls/fanotify/fanotify10.c     | 20 ++++++++++---------
 2 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/testcases/kernel/syscalls/fanotify/fanotify.h b/testcases/kernel/syscalls/fanotify/fanotify.h
index 810a48e81..936d6787e 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify.h
+++ b/testcases/kernel/syscalls/fanotify/fanotify.h
@@ -113,6 +113,9 @@ static inline int safe_fanotify_mark(const char *file, const int lineno,
 #define FAN_MARK_IGNORE_SURV	(FAN_MARK_IGNORE | FAN_MARK_IGNORED_SURV_MODIFY)
 #endif
 /* Non-uapi convenience macros */
+#ifndef FAN_MARK_PARENT
+#define FAN_MARK_PARENT		FAN_MARK_ONLYDIR
+#endif
 #ifndef FAN_MARK_TYPES
 #define FAN_MARK_TYPES (FAN_MARK_INODE | FAN_MARK_MOUNT | FAN_MARK_FILESYSTEM)
 #endif
diff --git a/testcases/kernel/syscalls/fanotify/fanotify10.c b/testcases/kernel/syscalls/fanotify/fanotify10.c
index ea05e4ff0..5d7b90e58 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify10.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify10.c
@@ -102,6 +102,7 @@ static unsigned int num_classes = NUM_CLASSES;
 
 enum {
 	FANOTIFY_INODE,
+	FANOTIFY_PARENT,
 	FANOTIFY_MOUNT,
 	FANOTIFY_FILESYSTEM,
 	FANOTIFY_EVICTABLE,
@@ -109,6 +110,7 @@ enum {
 
 static struct fanotify_mark_type fanotify_mark_types[] = {
 	INIT_FANOTIFY_MARK_TYPE(INODE),
+	INIT_FANOTIFY_MARK_TYPE(PARENT),
 	INIT_FANOTIFY_MARK_TYPE(MOUNT),
 	INIT_FANOTIFY_MARK_TYPE(FILESYSTEM),
 	INIT_FANOTIFY_MARK_TYPE(EVICTABLE),
@@ -243,57 +245,57 @@ static struct tcase {
 	},
 	{
 		"ignore child exec events created on a specific mount point",
-		MOUNT_PATH, FANOTIFY_INODE,
+		MOUNT_PATH, FANOTIFY_PARENT,
 		MOUNT_PATH, FANOTIFY_MOUNT,
 		0,
 		FILE_EXEC_PATH, FAN_OPEN_EXEC, FAN_OPEN | FAN_OPEN_EXEC
 	},
 	{
 		"ignore events on children of directory created on a specific file",
-		DIR_MNT2, FANOTIFY_INODE,
-		DIR_PATH, FANOTIFY_INODE,
+		DIR_PATH, FANOTIFY_PARENT,
+		DIR_PATH, FANOTIFY_PARENT,
 		FAN_EVENT_ON_CHILD,
 		FILE_PATH, 0, FAN_OPEN
 	},
 	{
 		"ignore events on file created inside a parent watching children",
 		FILE_PATH, FANOTIFY_INODE,
-		DIR_PATH, FANOTIFY_INODE,
+		DIR_PATH, FANOTIFY_PARENT,
 		FAN_EVENT_ON_CHILD,
 		FILE_PATH, 0, FAN_OPEN
 	},
 	{
 		"don't ignore events on file created inside a parent not watching children",
 		FILE_PATH, FANOTIFY_INODE,
-		DIR_PATH, FANOTIFY_INODE,
+		DIR_PATH, FANOTIFY_PARENT,
 		0,
 		FILE_PATH, FAN_OPEN, FAN_OPEN
 	},
 	{
 		"ignore mount events created inside a parent watching children",
 		FILE_PATH, FANOTIFY_MOUNT,
-		DIR_PATH, FANOTIFY_INODE,
+		DIR_PATH, FANOTIFY_PARENT,
 		FAN_EVENT_ON_CHILD,
 		FILE_PATH, 0, FAN_OPEN
 	},
 	{
 		"don't ignore mount events created inside a parent not watching children",
 		FILE_PATH, FANOTIFY_MOUNT,
-		DIR_PATH, FANOTIFY_INODE,
+		DIR_PATH, FANOTIFY_PARENT,
 		0,
 		FILE_PATH, FAN_OPEN, FAN_OPEN
 	},
 	{
 		"ignore fs events created inside a parent watching children",
 		FILE_PATH, FANOTIFY_FILESYSTEM,
-		DIR_PATH, FANOTIFY_INODE,
+		DIR_PATH, FANOTIFY_PARENT,
 		FAN_EVENT_ON_CHILD,
 		FILE_PATH, 0, FAN_OPEN
 	},
 	{
 		"don't ignore fs events created inside a parent not watching children",
 		FILE_PATH, FANOTIFY_FILESYSTEM,
-		DIR_PATH, FANOTIFY_INODE,
+		DIR_PATH, FANOTIFY_PARENT,
 		0,
 		FILE_PATH, FAN_OPEN, FAN_OPEN
 	},
-- 
2.25.1



More information about the ltp mailing list