[LTP] [PATCH v4] aio_cancel_7-1: Rewrite test
Petr Vorel
pvorel@suse.cz
Tue Sep 16 12:18:21 CEST 2025
Hi Martin,
> The test schedules multiple async writes into a file and then hopes that
> at least one will block long enough that it can be canceled
> before completion. Use a socket pair instead of a file to force async
> writes to block indefinitely and make sure at least one can be canceled.
> 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.
Great idea, nice rewrite, thank you!
Reviewed-by: Petr Vorel <pvorel@suse.cz>
...
> #include <stdio.h>
> #include <sys/types.h>
> #include <unistd.h>
> #include <sys/stat.h>
nit: also <sys/stat.h> and <sys/types.h> can be removed before merging.
Kind regards,
Petr
More information about the ltp
mailing list