From: Petr Vorel <pvorel@suse.cz>
To: Amir Goldstein <amir73il@gmail.com>
Cc: Jan Kara <jack@suse.cz>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH 1/5] fanotify13: Verify that we did not get an extra event
Date: Thu, 23 Jan 2025 18:18:26 +0100 [thread overview]
Message-ID: <20250123171826.GA125552@pevik> (raw)
In-Reply-To: <20250122172440.506677-2-amir73il@gmail.com>
Hi Amir, all,
> For example, verify that we did not get an event on a directory object
> without requesting FAN_ONDIR. Also, report a test failure if no events
> received at all instead of blocking on read of fanotify_fd.
> With this change, the test fails with overlayfs variants over btrfs,
> because the size of fid of overalyfs over btrfs is about 90 bytes and
> the events on the three objects do not all fit into a single 256 bytes
> buffer read. Increase the size of the events buffer to fix this failure.
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> ---
> .../kernel/syscalls/fanotify/fanotify13.c | 22 ++++++++++++++++---
> 1 file changed, 19 insertions(+), 3 deletions(-)
> diff --git a/testcases/kernel/syscalls/fanotify/fanotify13.c b/testcases/kernel/syscalls/fanotify/fanotify13.c
> index 5cd857707..16fd99ba1 100644
> --- a/testcases/kernel/syscalls/fanotify/fanotify13.c
> +++ b/testcases/kernel/syscalls/fanotify/fanotify13.c
> @@ -34,7 +34,7 @@
> #include "fanotify.h"
> #define PATH_LEN 128
> -#define BUF_SIZE 256
> +#define BUF_SIZE 1024
> #define DIR_ONE "dir_one"
> #define FILE_ONE "file_one"
> #define FILE_TWO "file_two"
> @@ -130,10 +130,15 @@ static int setup_marks(unsigned int fd, struct test_case_t *tc)
> SAFE_FANOTIFY_MARK(fd, FAN_MARK_ADD | mark->flag, tc->mask,
> AT_FDCWD, objects[i].path);
> - /* Setup the expected mask for each generated event */
> + /*
> + * Setup the expected mask for each generated event.
> + * No events are expected on directory without FAN_ONDIR.
> + */
> event_set[i].expected_mask = tc->mask;
> if (!objects[i].is_dir)
> event_set[i].expected_mask &= ~FAN_ONDIR;
> + else if (!(event_set[i].expected_mask & FAN_ONDIR))
> + event_set[i].expected_mask = 0;
> }
> return 0;
> }
> @@ -163,7 +168,8 @@ static void do_test(unsigned int number)
> return;
> }
> - fanotify_fd = SAFE_FANOTIFY_INIT(FAN_CLASS_NOTIF | FAN_REPORT_FID, O_RDONLY);
> + fanotify_fd = SAFE_FANOTIFY_INIT(FAN_CLASS_NOTIF | FAN_REPORT_FID |
> + FAN_NONBLOCK, O_RDONLY);
> /*
> * Place marks on a set of objects and setup the expected masks
> @@ -279,6 +285,16 @@ static void do_test(unsigned int number)
> FSID_VAL_MEMBER(event_fid->fsid, 1),
> *(unsigned long *) event_file_handle->f_handle);
> }
> +
> + /*
> + * Verify that we did not get an extra event, for example, that we did
> + * not get an event on directory without FAN_ONDIR.
> + */
> + if (event_set[i].expected_mask) {
> + tst_res(TFAIL,
> + "Did not get an expected event (expected: %llx)",
> + event_set[i].expected_mask);
I verified that on openSUSE on x86_64 test properly fails with 6.12.9:
fanotify13.c:282: TFAIL: handle_bytes (0) returned in event does not equal to handle_bytes (24) returned in name_to_handle_at(2)
and works with 6.12.10. So far so good.
But when testing on other archs, 6.12.10 fails on aarch64 and ppc64le:
fanotify13.c:339: TFAIL: Did not get an expected event (expected: 200)
That's a different failure than on 6.12.9.
Any hint what could be wrong?
Kind regards,
Petr
> + }
> out:
> SAFE_CLOSE(fanotify_fd);
> }
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2025-01-23 17:18 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-22 17:24 [LTP] [PATCH 0/5] LTP fanotify tests for v6.13 Amir Goldstein
2025-01-22 17:24 ` [LTP] [PATCH 1/5] fanotify13: Verify that we did not get an extra event Amir Goldstein
2025-01-23 17:18 ` Petr Vorel [this message]
2025-01-24 10:11 ` Petr Vorel
2025-01-24 10:33 ` Amir Goldstein
2025-01-24 12:45 ` Petr Vorel
2025-01-22 17:24 ` [LTP] [PATCH 2/5] fanotify13: Add test case for FAN_DELETE_SELF Amir Goldstein
2025-01-22 17:24 ` [LTP] [PATCH 3/5] fanotify05: Test reporting overflow event with FAN_REPORT_FD_ERROR Amir Goldstein
2025-01-24 7:44 ` Petr Vorel
2025-01-22 17:24 ` [LTP] [PATCH 4/5] fanotify21: Test reporting event with RDWR fd on RO mount Amir Goldstein
2025-01-24 8:01 ` Petr Vorel
2025-01-22 17:24 ` [LTP] [PATCH 5/5] fanotify21: Test reporting fd open errors with FAN_REPORT_FD_ERROR Amir Goldstein
2025-01-24 8:09 ` Petr Vorel
2025-01-22 20:50 ` [LTP] [PATCH 0/5] LTP fanotify tests for v6.13 Petr Vorel
2025-01-23 13:09 ` Amir Goldstein
2025-01-23 13:31 ` Cyril Hrubis
2025-01-24 10:46 ` Cyril Hrubis
2025-01-24 11:32 ` Petr Vorel
2025-01-30 20:07 ` Petr Vorel
2025-01-31 14:16 ` Amir Goldstein
2025-01-31 16:42 ` Petr Vorel
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=20250123171826.GA125552@pevik \
--to=pvorel@suse.cz \
--cc=amir73il@gmail.com \
--cc=jack@suse.cz \
--cc=ltp@lists.linux.it \
/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