[LTP] [PATCH v2] fanotify22.c: handle multiple asynchronous error events

Andrea Cervesato andrea.cervesato@suse.com
Mon Mar 9 11:26:17 CET 2026


Hi!

> +	/* Wait for asynchronous kworker threads to dispatch events */
> +	usleep(100000);
> +
>  	read_len = SAFE_READ(0, fd_notify, event_buf, BUF_SIZE);
> +	read_len = consolidate_events(event_buf, read_len);

This doesn't sound correct. Instead of usleep() and "guessing" if data
is coming or not, we should poll() over the fd_notify and collect data
until BUF_SIZE. If data doesn't arrive, it means events were not
dispatched and test fails.

Remember that (in general) sleep operations hide test faults or bugs, as
it's explained in the ground rules guide:

https://linux-test-project.readthedocs.io/en/latest/developers/ground_rules.html#why-is-sleep-in-tests-bad-then

Kind regards,
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com


More information about the ltp mailing list