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

   ## Summary
   
   `EPOLL_CTL_MOD` of a node in the setup list tears the old registration
   down and registers the new events. If that registration fails, the node
   stays in the setup list unregistered. Every node in the setup list is
   assumed registered: `epoll_do_close()` and `epoll_teardown()` tear it
   down again, so the driver gets one more teardown than setups. Move the
   node to the teardown list instead, which `epoll_setup()` retries on the
   next `epoll_wait()`.
   
   Also destroy `eph->sem` in `epoll_do_close()` and on the
   `epoll_do_create()` failure path; it was initialized but never destroyed.
   
   ## Impact
   
   Only the error path of `EPOLL_CTL_MOD` and epoll teardown change.
   
   ## Testing
   
   Host: Ubuntu x86_64, gcc (Ubuntu 13.1.0-8ubuntu1~22.04) 13.1.0, master 
512dee8309 (rebased onto 512dee8309; no
   new commit touches fs_epoll.c), `sim:nsh`. A test driver counts poll setup
   and teardown calls and fails the second setup:
   
   | step | master | this PR |
   |---|---|---|
   | `EPOLL_CTL_ADD` | 1 setup, 0 teardown | same |
   | `EPOLL_CTL_MOD` whose setup fails | -1 EIO, 1 setup, 1 teardown | same |
   | `close(epfd)` | 1 setup, 2 teardowns | 1 setup, 1 teardown |
   
   - `./tools/checkpatch.sh -g master..HEAD`: all checks pass.
   - Make and CMake builds pass; `ostest` exits with status 0.
   


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