[LTP] syscalls/fanotify26: Add test for nested permission events

linuxtestproject.agent@gmail.com linuxtestproject.agent@gmail.com
Wed Oct 28 10:15:42 CET 2026


> Subject: [PATCH] syscalls/fanotify26: Add test for nested permission events
>
> A permission event reported on a stacked filesystem opens the real file
> on the backing filesystem to install the event file descriptor. If the
...
> The second case fails on a kernel without the pending fix "fs: let
> backing files inherit FMODE_NONOTIFY from the user file", so the test is
> added to runtest/staging for now.

Since the test is added to runtest/staging for an unreleased kernel fix,
the commit subject must include the [STAGING] prefix:

    [STAGING] syscalls/fanotify26: Add test for nested permission events

> +static void answer_one_event(void)
> +{
> +	struct fanotify_event_metadata event;
> +	struct fanotify_response resp;
> +
> +	/* Blocks for good if the event fd generates a nested event. */
> +	SAFE_READ(1, fd_notify, &event, sizeof(event));

Please use SAFE_READ_ALL instead of the literal 1, matching
SAFE_WRITE_ALL below:

	SAFE_READ(SAFE_READ_ALL, fd_notify, &event, sizeof(event));

> +	/* Releases whatever is still queued, so the opener can finish. */
> +	SAFE_CLOSE(fd_notify);
> +
> +	SAFE_WAITPID(opener, NULL, 0);
> +}

This SAFE_WAITPID() is redundant and discards the child's exit status.
The test library calls tst_reap_children() automatically after each
run() iteration, which waits for remaining children and verifies that
they exited cleanly.


More information about the ltp mailing list