Skip to content

fix(nfs): close write files on seek and write errors - #4

Open
snajpa wants to merge 1 commit into
masterfrom
fix/write-close-on-error
Open

snajpa wants to merge 1 commit into
masterfrom
fix/write-close-on-error

Conversation

@snajpa

@snajpa snajpa commented Oct 10, 2026

Copy link
Copy Markdown

Summary

Close the file owned by a WRITE request when Seek or Write fails, preserving the primary NFS status and including any Close failure as diagnostic context. Success and ordinary close-error behavior remain unchanged; a backend Close error is not a guarantee of physical resource retirement.

Verification

  • Real-file loopback regression covers seven success/failure cases; normal and race repetitions pass on Go 1.26.8 and Go 1.19.13. Restoring the old handler reproduces the missed-Close and still-open-file failures. Full normal tests, one full race run and vet pass on Go 1.26.8.
  • Both cuts build on Go 1.19.13, but existing helper tests using t.Context prevent its full-module test compilation. Some broader repeated runs hit existing client source-port collisions; these are not claimed as passing.

A WRITE request owns the file opened by its handler. Seek and partial-write failures previously returned without closing it, leaving retirement to backend finalizers instead of request completion.

Close once on both failure exits, preserve the primary error identity and NFS status, and include any close failure as diagnostic context. Keep the normal success and close-error paths unchanged; use APIs compatible with the declared Go version.

Loopback regressions use real temporary files and cover open, seek, partial-write, success and close-error paths. Restoring the previous handler fails the owned-close and closed-file assertions. Full normal tests, a full race run, vet and the consuming proxy race regression pass; an earlier repeated full race attempt hit client source-port collisions. No claim is made that every backend physically retires a resource after a failed Close.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant