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

   ## Summary
   
   `aio_fsync()` rejected any `op` other than `O_SYNC` with EINVAL.
   `O_SYNC` is defined as `(__O_SYNC | O_DSYNC)`, so it is not equal to
   `O_DSYNC` and a caller passing `O_DSYNC` was rejected. POSIX requires
   both values to be accepted, and the function's own documentation says
   so. Test the two values separately. A NULL `aiocbp` is still rejected.
   
   The check was added in d4dc0f6ec78 (#9643), when `O_DSYNC` was defined
   as `O_SYNC`, so both values passed. 9e141acab36 later gave `O_SYNC` its
   own bit, and from then on `O_DSYNC` was rejected.
   
   ## Impact
   
   `aio_fsync(O_DSYNC, ...)` now queues the request instead of failing with
   EINVAL. `O_SYNC` and invalid values behave as before.
   
   ## Testing
   
   Host: Ubuntu x86_64, gcc (Ubuntu 13.1.0-8ubuntu1~22.04) 13.1.0, master 
03aea78639, `sim:nsh` with
   `CONFIG_FS_AIO=y` and `CONFIG_SCHED_LPWORK=y`. A small test program
   writes to a file and calls `aio_fsync()` with each value, then waits
   for completion:
   
   | op | master | this PR |
   |---|---|---|
   | `O_SYNC` | queued, `aio_error()` 0, `aio_return()` 0 | same |
   | `O_DSYNC` | -1, EINVAL | queued, `aio_error()` 0, `aio_return()` 0 |
   
   - `./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