jerpelea opened a new pull request, #20280:
URL: https://github.com/apache/nuttx/pull/20280
## Summary
Rework lio_listio() to link all requests of a batch into a list before
submitting any I/O; aio_signal() then removes each completed node under
aio_lock() and notifies the caller only when the list becomes empty. This fixes
the thread-unsafe "submit first, set up notification state later" ordering of
the old implementation.
Fix a family of crashes around the new lio_link machinery:
uninitialized/overwritten list nodes (use list_clear_node() for non-batch
operations, call the new aio_read_internal()/aio_write_internal() from
lio_listio() to preserve list membership), a NULL-aiocbp dereference when no
I/O could be queued, and an invalid list_delete() for failed submissions in
LIO_WAIT mode.
Fix aioc use-after-free: the I/O workers decanted (freed) the container
before signaling completion; aioc_decant() now runs after aio_signal().
Fix aio_cancel(): endless loop when cancelling already-running I/O, and
missing EBADF validation of the file descriptor (file_get()/file_put()).
Align aio_read()/aio_write()/aio_error() return values with POSIX: -1 +
errno = EINVAL for rejected requests (also retrievable via aio_error()), but 0
with the error reported through aio_error() for a bad file descriptor.
aio_suspend() now re-checks the completion list after every wakeup so a
SIGPOLL from unrelated AIO no longer causes a spurious return, and the timeout
is honored across wakeups.
Reject a NULL aiocbp in aio_fsync() (POSIX Issue 6 removed the NULL special
case).
Make the lio_listio() prototype match POSIX (restrict qualifiers, unnamed
parameters).
Add a configurable CONFIG_FS_AIO_LISTIO_MAX (default 10), validate nent
against {AIO_LISTIO_MAX} in lio_listio(), and report it via
sysconf(_SC_AIO_LISTIO_MAX).
Move lio_listio.c from libs/libc/aio to fs/aio so the whole AIO
implementation lives in one directory.
## Impact
RELEASE
## Testing
CI
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]