raiden00pl opened a new pull request, #20112:
URL: https://github.com/apache/nuttx/pull/20112

   
   ## Summary
   
   work_cancel() used to return -ENOENT when the work structure was not in the 
queue, and callers depend on that: aio_cancel() tears down the AIO container 
(file_put() + aioc_free()) only when work_cancel() reports success, because a 
work item that is not queued may already be executing on a worker thread (see 
the comment in fs/aio/aio_cancel.c).
   
   Since commit 6f72f5481d ("sched/wqueue: Refactor delayed and periodical 
workqueue") work_cancel() returns OK unconditionally, and commit d2e01b90553 
("sched/wqueue: harden custom queue lifecycle") kept that behaviour and dropped 
-ENOENT from the function documentation.  Under SMP the LTP aio_cancel tests 
then free the aio container and its file while the lpwork thread is still 
executing aio_write_worker() on it, which ends in a page fault in file_write() 
(f_inode == NULL) and a panic.
   
   Return -ENOENT again when the work is not queued, and document it. For the 
synchronous variant "not queued" alone does not tell whether the callback is 
running: the worker scan does, so report OK when a running callback was found 
and waited for, and -ENOENT only when the work was neither queued nor running.
   
   taken from #20030
   
   ## Impact
   
   required for SMP intel64 to pass LPT tests
   
   ## Testing
   
   Summary
   various issues with AIO found by NTFC with LPT tests:
   
   sched/wqueue: restore -ENOENT from work_cancel() for unqueued work
   libs/libc/aio: fix nxstyle issues in lio_listio.c
   libs/libc/aio: fix lio_listio() racing with early I/O completion
   fs/aio: advance the pending list in aio_cancel() before work_cancel()
   fs/aio: decant the container only after the I/O has been performed
   taken from #20030
   
   Impact
   required for SMP intel64 to pass LPT tests
   
   Testing
   CI pass: 
https://github.com/apache/nuttx/actions/runs/34236734404/job/102183306099?pr=20030


-- 
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]

Reply via email to