feat(libkernel): sync each write on a file whose O_FSYNC flag is set #9561

Merged
DavidSamir merged 5 commits from upstream-pr/9561 into main 2026-10-26 01:26:06 +00:00
DavidSamir commented 2026-10-22 02:23:42 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-22T02:23:42Z.


What

fcntl(F_SETFL) threw when it changed O_FSYNC on a file. FreeBSD 11 allows the change, because FCNTLFLAGS includes O_FSYNC (sys/kern/kern_descrip.c:558-559). While the flag is set, vn_write writes with IO_SYNC (sys/kern/vfs_vnops.c:871-873), so each write reaches the disk before the call returns.

How it works now:

  • The flag: it lives in the descriptor's status table, so dup, dup2 and F_DUPFD share it, as for the other status flags. F_SETFL sets and clears it on a file, and F_GETFL reports it.
  • The sync: File::SyncWrites(fd) syncs a regular file (sceKernelFsync) while its open file has O_FSYNC set. A failed host sync throws rather than passing silently. Pipes and other descriptors are never synced.
  • Where it runs: a File::WriteSync guard calls it after each write entry point, placed just before the host write:
    • sceKernelWrite, which write and _write reach;
    • pwrite, and sceKernelPwrite on each platform;
    • the write path of TransferIovecs (Windows writev/pwritev);
    • sceKernelWritev/sceKernelPwritev on Linux.
  • Opening with O_FSYNC: a file opened with the flag behaves the same.
  • A Linux difference: a file opened with O_SYNC keeps the host's O_SYNC after F_SETFL clears the flag, because Linux can't drop it. That's only extra durability, not a visible difference, and the debt line says so.

A sync can't be observed from the guest, so FileSynchronousWritesForTest_nid_no_patch() counts syncs for the test. It follows the existing *ForTest seams.

Tested

Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release. This is CPU-side, so no GPU is involved.

New test guest_kernel_fcntl_sync (core/libs/tests/GuestKernelFcntlSync.cpp), which covers:

  • F_SETFL setting and clearing O_FSYNC, with F_GETFL reporting it;
  • exactly one sync per write, writev, pwrite and pwritev;
  • a dup sharing the flag, and no sync after it is cleared;
  • the data reading back correctly;
  • a file opened with O_FSYNC syncing its writes;
  • a pipe with O_FSYNC never syncing.

guest_kernel_fcntl's check that changing O_FSYNC throws now expects success instead.

Results:

  • It passes, 3 of 3 runs. The 15 tests matching guest_kernel_fcntl, guest_append, guest_dup, guest_file, guest_writev and iovec pass.

  • Negative controls:

    • with SyncWrites returning early, the test fails at line 62;
    • without the writev guard, it fails at line 64.
  • tools/check_conventions.py: 0 errors. Its one warning is the length of the fcntl debt entry, which was already over 1000 characters on main.

  • Overlap: tools/pr_overlap.py --branch plus git merge-tree. The code merges cleanly with #9131, #7121, #8520 and #9019. The guards sit next to the host write calls, away from the lines those PRs change.

  • Conflicts that remain, all textual:

    • the long fcntl debt line, docs/dev/debt/libkernel.md:218, which #9256, #8544, #9109 and #9557 also rewrite;
    • #9256's lines 283-284 of core/libs/tests/GuestKernelFcntl.cpp (its O_APPEND change sits next to this O_FSYNC check).

    Whichever merges second keeps both changes.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:4961145762 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9561). Originally posted by [DavidSamir](https://github.com/DavidSamir) on 2026-10-22T02:23:42Z. --- ### What `fcntl(F_SETFL)` threw when it changed `O_FSYNC` on a file. FreeBSD 11 allows the change, because `FCNTLFLAGS` includes `O_FSYNC` (`sys/kern/kern_descrip.c:558-559`). While the flag is set, `vn_write` writes with `IO_SYNC` (`sys/kern/vfs_vnops.c:871-873`), so each write reaches the disk before the call returns. How it works now: - **The flag:** it lives in the descriptor's status table, so `dup`, `dup2` and `F_DUPFD` share it, as for the other status flags. `F_SETFL` sets and clears it on a file, and `F_GETFL` reports it. - **The sync:** `File::SyncWrites(fd)` syncs a regular file (`sceKernelFsync`) while its open file has `O_FSYNC` set. A failed host sync throws rather than passing silently. Pipes and other descriptors are never synced. - **Where it runs:** a `File::WriteSync` guard calls it after each write entry point, placed just before the host write: - `sceKernelWrite`, which `write` and `_write` reach; - `pwrite`, and `sceKernelPwrite` on each platform; - the write path of `TransferIovecs` (Windows `writev`/`pwritev`); - `sceKernelWritev`/`sceKernelPwritev` on Linux. - **Opening with `O_FSYNC`:** a file opened with the flag behaves the same. - **A Linux difference:** a file opened with `O_SYNC` keeps the host's `O_SYNC` after `F_SETFL` clears the flag, because Linux can't drop it. That's only extra durability, not a visible difference, and the debt line says so. A sync can't be observed from the guest, so `FileSynchronousWritesForTest_nid_no_patch()` counts syncs for the test. It follows the existing `*ForTest` seams. ### Tested Windows 11 Pro 26200, WinLibs GCC 15.2.0 r7, Release. This is CPU-side, so no GPU is involved. New test `guest_kernel_fcntl_sync` (`core/libs/tests/GuestKernelFcntlSync.cpp`), which covers: - `F_SETFL` setting and clearing `O_FSYNC`, with `F_GETFL` reporting it; - exactly one sync per `write`, `writev`, `pwrite` and `pwritev`; - a `dup` sharing the flag, and no sync after it is cleared; - the data reading back correctly; - a file opened with `O_FSYNC` syncing its writes; - a pipe with `O_FSYNC` never syncing. `guest_kernel_fcntl`'s check that changing `O_FSYNC` throws now expects success instead. Results: - It passes, 3 of 3 runs. The 15 tests matching `guest_kernel_fcntl`, `guest_append`, `guest_dup`, `guest_file`, `guest_writev` and iovec pass. - Negative controls: - with `SyncWrites` returning early, the test fails at line 62; - without the `writev` guard, it fails at line 64. - `tools/check_conventions.py`: 0 errors. Its one warning is the length of the `fcntl` debt entry, which was already over 1000 characters on `main`. - Overlap: `tools/pr_overlap.py --branch` plus `git merge-tree`. The code merges cleanly with #9131, #7121, #8520 and #9019. The guards sit next to the host write calls, away from the lines those PRs change. - Conflicts that remain, all textual: - the long `fcntl` debt line, `docs/dev/debt/libkernel.md:218`, which #9256, #8544, #9109 and #9557 also rewrite; - #9256's lines 283-284 of `core/libs/tests/GuestKernelFcntl.cpp` (its `O_APPEND` change sits next to this `O_FSYNC` check). Whichever merges second keeps both changes. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
jotitadev commented 2026-10-22 03:39:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-22T03:39:05Z.

Review: COMMENTED


First run on Linux (the PR is tested on Windows only). Ubuntu 26.04, x86_64, Intel i7-8700, GCC 15.2.0, Release, BUILD_TESTING=ON, head b86238f6e merged --no-commit onto current origin/main (6ef5a1c4c).

  • Build: ok.
  • ctest -R "guest_kernel_fcntl_sync|guest_kernel_fcntl$" with the PR: both pass.
  • Negative control (revert Open.cpp and Stdio.cpp to origin/main, keeping DescriptorControl.cpp so the *ForTest counter still links): guest_kernel_fcntl_sync fails at the first O_FSYNC write
check failed at line 62

that is, Synced() == before + 1 after write on an O_FSYNC file no longer holds once the WriteSync call sites are gone. This matches the line the PR description predicts for the SyncWrites-early control.

  • Restoring the PR implementation: passes again.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5608981082 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9561#pullrequestreview-5608981082). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-22T03:39:05Z. **Review:** COMMENTED --- First run on Linux (the PR is tested on Windows only). Ubuntu 26.04, x86_64, Intel i7-8700, GCC 15.2.0, Release, `BUILD_TESTING=ON`, head b86238f6e merged `--no-commit` onto current `origin/main` (6ef5a1c4c). - Build: ok. - `ctest -R "guest_kernel_fcntl_sync|guest_kernel_fcntl$"` with the PR: both pass. - Negative control (revert `Open.cpp` and `Stdio.cpp` to `origin/main`, keeping `DescriptorControl.cpp` so the `*ForTest` counter still links): `guest_kernel_fcntl_sync` fails at the first O_FSYNC write ``` check failed at line 62 ``` that is, `Synced() == before + 1` after `write` on an `O_FSYNC` file no longer holds once the `WriteSync` call sites are gone. This matches the line the PR description predicts for the `SyncWrites`-early control. - Restoring the PR implementation: passes again. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
MarcZX10 commented 2026-10-22 04:02:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T04:02:32Z.

Review: CHANGES_REQUESTED


The implementation covers the O_FSYNC flag and the reported Linux negative-control run confirms the focused test fails when the sync call path is removed. The Windows test results are author-reported; an independent Linux build/test report is present. Hosted conventions, eligibility, intake, labels and report checks pass; product/relinker jobs are skipped. I did not run tests locally.

Before approval, please resolve the integration requirements recorded in the PR itself. The test changes overlap #9256 in GuestKernelFcntl.cpp, and the changed fcntl debt row overlaps #9557, #9256, #8544 and #9109. Please agree the merge/rebase order with the affected authors, preserve both test/debt changes, and add Depends on wherever another PR must land first. “Whichever merges second keeps both changes” is not yet recorded author agreement.

Also update this branch from current main: its base is 6ef5a1c4, while upstream main is d9c99c9. The intervening merge appears unrelated, but CONTRIBUTING requires branches to stay current. Rerun the focused fcntl/write tests after the update and identify the tested head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5609108544 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9561#pullrequestreview-5609108544). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T04:02:32Z. **Review:** CHANGES_REQUESTED --- The implementation covers the `O_FSYNC` flag and the reported Linux negative-control run confirms the focused test fails when the sync call path is removed. The Windows test results are author-reported; an independent Linux build/test report is present. Hosted conventions, eligibility, intake, labels and report checks pass; product/relinker jobs are skipped. I did not run tests locally. Before approval, please resolve the integration requirements recorded in the PR itself. The test changes overlap #9256 in `GuestKernelFcntl.cpp`, and the changed `fcntl` debt row overlaps #9557, #9256, #8544 and #9109. Please agree the merge/rebase order with the affected authors, preserve both test/debt changes, and add `Depends on` wherever another PR must land first. “Whichever merges second keeps both changes” is not yet recorded author agreement. Also update this branch from current `main`: its base is `6ef5a1c4`, while upstream `main` is `d9c99c9`. The intervening merge appears unrelated, but CONTRIBUTING requires branches to stay current. Rerun the focused fcntl/write tests after the update and identify the tested head.
harisibrar1 commented 2026-10-22 06:01:31 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-22T06:01:31Z.

Review: COMMENTED


Checked against main 4a17c7175 and libstdc++ 15.2 (WinLibs) <optional>:

  • In the Windows TransferIovecs (Stdio.cpp:1312-1313) the guard sits in a std::optional<File::WriteSync>. libstdc++'s _Optional_payload_base::_M_destroy() is noexcept (<optional>:304-308), so when SyncWrites throws from ~WriteSync() noexcept(false) there, the process hits std::terminate instead of the intended runtime_error. That affects Windows writev/pwritev on an O_FSYNC file whose FlushFileBuffers fails. I reproduced it with a minimal copy of the guard built with GCC 15.2: the plain const G g; form propagates the exception, while the optional-wrapped one prints "terminate called after throwing an instance of 'std::runtime_error'" and exits with code 3. A fix with no other changes would be const File::WriteSync sync(write ? d : -1);, since SyncWrites(-1) already returns early.
  • Minor: the destructor also syncs, and bumps the counter, after a host write that failed. Checking the result first would keep the counter to successful writes, which is closer to vn_write adding IO_SYNC to the write itself.
  • Minor: sceKernelAioSubmitWriteCommands* writes through Aio.cpp's NativePwrite without the guard. Since it is unknown whether the console's AIO honours O_FSYNC, the new debt sentence ("each write on a file") could be narrowed, or AIO noted there.

Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5609873569 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9561#pullrequestreview-5609873569). Originally posted by [harisibrar1](https://github.com/harisibrar1) on 2026-10-22T06:01:31Z. **Review:** COMMENTED --- Checked against main 4a17c7175 and libstdc++ 15.2 (WinLibs) `<optional>`: - In the Windows `TransferIovecs` (Stdio.cpp:1312-1313) the guard sits in a `std::optional<File::WriteSync>`. libstdc++'s `_Optional_payload_base::_M_destroy()` is `noexcept` (`<optional>:304-308`), so when `SyncWrites` throws from `~WriteSync() noexcept(false)` there, the process hits `std::terminate` instead of the intended `runtime_error`. That affects Windows `writev`/`pwritev` on an `O_FSYNC` file whose `FlushFileBuffers` fails. I reproduced it with a minimal copy of the guard built with GCC 15.2: the plain `const G g;` form propagates the exception, while the optional-wrapped one prints "terminate called after throwing an instance of 'std::runtime_error'" and exits with code 3. A fix with no other changes would be `const File::WriteSync sync(write ? d : -1);`, since `SyncWrites(-1)` already returns early. - Minor: the destructor also syncs, and bumps the counter, after a host write that failed. Checking the result first would keep the counter to successful writes, which is closer to `vn_write` adding `IO_SYNC` to the write itself. - Minor: `sceKernelAioSubmitWriteCommands*` writes through `Aio.cpp`'s `NativePwrite` without the guard. Since it is unknown whether the console's AIO honours `O_FSYNC`, the new debt sentence ("each write on a file") could be narrowed, or AIO noted there. Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
DavidSamir commented 2026-10-22 07:51:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by DavidSamir on 2026-10-22T07:51:43Z.


Thanks to both of you. New commits, no force-push:

  • 896de840eb: fixes the std::optional guard @harisibrar1 found (thanks for the reproduction).
    • The Windows TransferIovecs now uses a plain const File::WriteSync sync(write ? d : -1);, so a failing sync reaches the caller as the runtime_error instead of std::terminate. SyncWrites(-1) returns early because -1 has no entry.
    • The debt sentence now names the synced calls (write, pwrite, writev, pwritev) and says the sceKernelAioSubmitWriteCommands writes are not synced, since whether the console's AIO honours the flag is unknown.
    • I left the "sync after a failed host write" point as it is. The sync of a file whose write failed is harmless, and the counter is only a test seam, but I can move the sync behind the result if you'd rather.
  • aad3acf9ab: merges current main (d6eafa54d0), as @MarcZX10 asked.

Re-run on the merge (Windows 11, WinLibs GCC 15.2): guest_kernel_fcntl, guest_kernel_fcntl_sync and guest_append_writes pass, and check_conventions.py reports 0 errors. Its one warning is the fcntl debt entry, which is already 4143 characters on main.

On the overlaps (#9256 in GuestKernelFcntl.cpp; the fcntl debt row with #9557, #9256, #8544 and #9109), I'm asking those authors for an agreed order and will record it in the checklist.

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6335657644 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9561#issuecomment-6335657644). Originally posted by [DavidSamir](https://github.com/DavidSamir) on 2026-10-22T07:51:43Z. --- Thanks to both of you. New commits, no force-push: - **`896de840eb`:** fixes the `std::optional` guard @harisibrar1 found (thanks for the reproduction). - The Windows `TransferIovecs` now uses a plain `const File::WriteSync sync(write ? d : -1);`, so a failing sync reaches the caller as the `runtime_error` instead of `std::terminate`. `SyncWrites(-1)` returns early because `-1` has no entry. - The debt sentence now names the synced calls (`write`, `pwrite`, `writev`, `pwritev`) and says the `sceKernelAioSubmitWriteCommands` writes are not synced, since whether the console's AIO honours the flag is unknown. - I left the "sync after a failed host write" point as it is. The sync of a file whose write failed is harmless, and the counter is only a test seam, but I can move the sync behind the result if you'd rather. - **`aad3acf9ab`:** merges current `main` (`d6eafa54d0`), as @MarcZX10 asked. Re-run on the merge (Windows 11, WinLibs GCC 15.2): `guest_kernel_fcntl`, `guest_kernel_fcntl_sync` and `guest_append_writes` pass, and `check_conventions.py` reports 0 errors. Its one warning is the `fcntl` debt entry, which is already 4143 characters on `main`. On the overlaps (#9256 in `GuestKernelFcntl.cpp`; the `fcntl` debt row with #9557, #9256, #8544 and #9109), I'm asking those authors for an agreed order and will record it in the checklist. AI-assisted: yes
MarcZX10 commented 2026-10-22 11:21:51 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T11:21:51Z.


The latest head includes the fixes for the optional-destructor exception path and narrows the AIO claim as discussed. The overlap report still calls out #9256's adjacent test and shared debt edits with #9557/#9256/#8544/#9109. I found DavidSamir's proposal to Dom3005 on #9256, but no reply confirming the order yet; please record the affected authors' agreement in the checklist and add if an order is required. Also, current upstream/main is 4777caca34 and this head is 3 ahead/11 behind (merge base d6eafa54d), so CONTRIBUTING's current-main requirement still applies. Please update and rerun the focused fcntl/write tests on that resulting head. Hosted eligibility/conventions/labels/report succeeded, product/relinker jobs are skipped. I did not run the C++ tests locally: there is no reusable test binary in the available checkouts and the filesystem is full, so I am treating the Windows/Linux test reports in this PR as reported evidence, not my own run.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6339509833 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9561#issuecomment-6339509833). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T11:21:51Z. --- The latest head includes the fixes for the optional-destructor exception path and narrows the AIO claim as discussed. The overlap report still calls out #9256's adjacent test and shared debt edits with #9557/#9256/#8544/#9109. I found DavidSamir's proposal to Dom3005 on #9256, but no reply confirming the order yet; please record the affected authors' agreement in the checklist and add if an order is required. Also, current upstream/main is 4777caca34 and this head is 3 ahead/11 behind (merge base d6eafa54d), so CONTRIBUTING's current-main requirement still applies. Please update and rerun the focused fcntl/write tests on that resulting head. Hosted eligibility/conventions/labels/report succeeded, product/relinker jobs are skipped. I did not run the C++ tests locally: there is no reusable test binary in the available checkouts and the filesystem is full, so I am treating the Windows/Linux test reports in this PR as reported evidence, not my own run.
MarcZX10 commented 2026-10-22 11:21:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T11:21:52Z.

Review: DISMISSED


The functional issues raised in review appear addressed on aad3acf9ab, including the Windows optional-guard exception issue and explicit AIO limitation. I cannot approve while two CONTRIBUTING integration requirements remain unverified: (1) update from current upstream/main 4777caca34 (the branch is 3 ahead/11 behind, merge base d6eafa54d), then rerun focused tests and update Tested; (2) record agreement with affected authors for the adjacent #9256 fcntl test and shared debt-row changes, including a Depends on entry if any PR must land first. The hosted product and relinker jobs are skipped. I did not run tests locally due to a full filesystem and absence of a reusable focused test binary.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5613367726 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9561#pullrequestreview-5613367726). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T11:21:52Z. **Review:** DISMISSED --- The functional issues raised in review appear addressed on aad3acf9ab, including the Windows optional-guard exception issue and explicit AIO limitation. I cannot approve while two CONTRIBUTING integration requirements remain unverified: (1) update from current upstream/main 4777caca34 (the branch is 3 ahead/11 behind, merge base d6eafa54d), then rerun focused tests and update Tested; (2) record agreement with affected authors for the adjacent #9256 fcntl test and shared debt-row changes, including a Depends on entry if any PR must land first. The hosted product and relinker jobs are skipped. I did not run tests locally due to a full filesystem and absence of a reusable focused test binary.
MarcZX10 commented 2026-10-22 11:24:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T11:24:27Z.


For clarity on the overlap details: the adjacent test edit is core/libs/tests/GuestKernelFcntl.cpp with #9256, and the shared technical-debt entry is docs/dev/debt/libkernel.md with #9256, #9557, #8544 and #9109. I found DavidSamir’s merge-order proposal on #9256 but no confirmation from the affected author yet, so the checklist should record agreement once it is obtained; list Depends on if ordering is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6339555556 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9561#issuecomment-6339555556). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-22T11:24:27Z. --- For clarity on the overlap details: the adjacent test edit is `core/libs/tests/GuestKernelFcntl.cpp` with #9256, and the shared technical-debt entry is `docs/dev/debt/libkernel.md` with #9256, #9557, #8544 and #9109. I found DavidSamir’s merge-order proposal on #9256 but no confirmation from the affected author yet, so the checklist should record agreement once it is obtained; list Depends on if ordering is required.
harisibrar1 commented 2026-10-22 12:54:56 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by harisibrar1 on 2026-10-22T12:54:56Z.

Review: APPROVED


Rechecked at aad3acf9a:

  • The Windows TransferIovecs now uses a plain const File::WriteSync sync(write ? d : -1); (Stdio.cpp:1312). A standalone copy of the guard built with GCC 15.2 now passes the sync runtime_error to the caller instead of calling std::terminate, and the read path (-1) does nothing.
  • The narrowed debt sentence (synced calls named, AIO writes stated as not synced) addresses the AIO point.
  • Your reasoning on syncing after a failed write is fine with me. Even a write on an O_RDONLY|O_FSYNC file ends in a sync that NativeSync treats as success on the access-denied reopen, so no errno turns into a throw.

Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5614478368 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/9561#pullrequestreview-5614478368). Originally posted by [harisibrar1](https://github.com/harisibrar1) on 2026-10-22T12:54:56Z. **Review:** APPROVED --- Rechecked at aad3acf9a: - The Windows `TransferIovecs` now uses a plain `const File::WriteSync sync(write ? d : -1);` (Stdio.cpp:1312). A standalone copy of the guard built with GCC 15.2 now passes the sync `runtime_error` to the caller instead of calling `std::terminate`, and the read path (`-1`) does nothing. - The narrowed debt sentence (synced calls named, AIO writes stated as not synced) addresses the AIO point. - Your reasoning on syncing after a failed write is fine with me. Even a write on an `O_RDONLY|O_FSYNC` file ends in a sync that `NativeSync` treats as success on the access-denied reopen, so no errno turns into a throw. Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!9561
No description provided.