[LTP] [PATCH] aio_cancel_5-1: Rewrite test
Petr Vorel
pvorel@suse.cz
Wed Jan 14 13:47:23 CET 2026
Hi Martin,
> The test schedules multiple async writes into a file and then hopes that
> at least one will block long enough that aio_cancel() will fail to cancel
> it. Use a socket pair instead of a file to force async writes to block
> indefinitely. Then wait for one of the writes to actually block on full
> socket buffer. This fixes a race condition where aio_cancel() could be
> called while no write is actually in progress (before the first write,
> after the last one or between two writes) and the test would fail.
> Also rewrite result checks to verify that all writes before the blocked
> one actually completed and all writes after the blocked one were cancelled.
> Add cleanup helper function that will flush socket buffers, free allocated
> memory and close the sockets. Also make setup and cleanup simpler
> by statically allocating the aiocb structure array.
+1, thank you. Similar way as your fix for aio_cancel_7-1 in 220f579cd6.
I wonder if some other needs to be fixed this way.
...
> * method:
> *
> - * queue a some aio_write() to a file descriptor
> + * queue some aio_write() to a file descriptor
We now use socket. Maybe update docs?
Code itself LGTM.
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Kind regards,
Petr
More information about the ltp
mailing list