aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmir Goldstein <amir73il@gmail.com>2023-11-21 12:52:47 +0200
committerPetr Vorel <pvorel@suse.cz>2024-01-24 21:41:50 +0100
commit9062824a70b8da74aa5b1db08710d0018b48072e (patch)
tree96cf0c4e531462f6cfd8e8e29a11e301c18e90d8
parentea085713f0f1efd23814077c257f4caae4b8f9c4 (diff)
downloadltp-9062824a70b8da74aa5b1db08710d0018b48072e.tar.gz
fanotify16: Fix test failure on FUSE
Split SAFE_CREAT() into explicit SAFE_MKNOD() and SAFE_OPEN(), because with atomic open (e.g. fuse), SAFE_CREAT() generates FAN_OPEN before FAN_CREATE (tested with ntfs-3g), which is inconsistent with the order of events expectated from other filesystems. Reviewed-by: Petr Vorel <pvorel@suse.cz> Tested-by: Petr Vorel <pvorel@suse.cz> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
-rw-r--r--testcases/kernel/syscalls/fanotify/fanotify16.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/testcases/kernel/syscalls/fanotify/fanotify16.c b/testcases/kernel/syscalls/fanotify/fanotify16.c
index 2cc56b5bd..6ab360984 100644
--- a/testcases/kernel/syscalls/fanotify/fanotify16.c
+++ b/testcases/kernel/syscalls/fanotify/fanotify16.c
@@ -339,7 +339,15 @@ static void do_test(unsigned int number)
tst_count++;
/* Generate modify events "on child" */
- fd = SAFE_CREAT(fname1, 0755);
+
+ /*
+ * Split SAFE_CREAT() into explicit SAFE_MKNOD() and SAFE_OPEN(),
+ * because with atomic open (e.g. fuse), SAFE_CREAT() generates
+ * FAN_OPEN before FAN_CREATE and it is inconsistent with the order
+ * of events expectated from other filesystems.
+ */
+ SAFE_MKNOD(fname1, S_IFREG | 0644, 0);
+ fd = SAFE_OPEN(fname1, O_WRONLY);
/* Save the file fid */
fanotify_save_fid(fname1, &file_fid);