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

Andrea Cervesato via ltp
2026-03-27T14:19:56Z

Hi Wei,

we still have a problem with the patch. We are considering deterministic
events, where one event comes after the other.

consolidate_events() accepts events matching either ex->error or
ex->error2:

> + if (info->error != ex->error && (ex->error2 == 0 || info->error != ex->error2)) {

but the first accepted event becomes the one passed to check_event().
Since event delivery order is non-deterministic, the first event could
have error == ESHUTDOWN (error2). check_error_event_info_error() then
only checks against ex->error:

> if (info_error->error != ex->error) {
> tst_res(TFAIL, "Unexpected error code value (%d!=%d)",
> info_error->error, ex->error);

So it compares ESHUTDOWN against EFSCORRUPTED, doesn't match, and
reports TFAIL.

We need to change that into:

if (info_error->error != ex->error &&
(ex->error2 == 0 || info_error->error != ex->error2)) {

Similar to the consolidate_events(), otherwise we will have a TFAIL when
events don't arrive in the same order. Did you try to run patch with a high
number of `-i` ? It should fails sometimes with the actual code.

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