Skip to content

[release/10.0] Fix operator precedence bug in SystemNative_FSync causing silent fsync errors - #135261

Open
adamsitnik with Copilot wants to merge 1 commit into
release/10.0from
copilot/backport-fix-issue-135201
Open

adamsitnik with Copilot wants to merge 1 commit into
release/10.0from
copilot/backport-fix-issue-135201

Conversation

Copilot AI commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

backports #124725 (merged into main in February 2026) to release/10.0

Description

C operator precedence bug in SystemNative_FSync (pal_io.c) caused fcntl(fd, F_FULLFSYNC) errors to be silently swallowed on Unix, leading to corrupt/truncated files on SMB network shares.

Customer Impact

On Unix, FileStream.Flush(flushToDisk: true) could silently ignore fsync failures, including storage errors such as ENOSPC or EIO, risking silent data loss. The fix ensures these errors propagate as exceptions.

Asked for backport by customer in #135201

Regression

This is a backport of a fix for a long-standing regression originating in .NET 6.

Testing

  • ./build.sh clr+libs -rc release passed with 0 warnings and 0 errors.
  • System.IO.FileSystem.Tests passed: 8,760 total, 0 failures, 54 skipped.
  • Verified FileStream.Flush(true) throws IOException when strace injects EIO into fsync on the rebuilt runtime.

Risk

Low. The change corrects the syscall-result assignment to preserve the actual return value and maintains the existing EINTR retry behavior. The macOS fallback is included from the main PR. No managed API surface changes.

fixes #135201

Co-authored-by: adamsitnik <6011991+adamsitnik@users.noreply.github.com>
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
13 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @agocke
See info in area-owners.md if you want to be subscribed.

@adamsitnik adamsitnik added this to the 10.0.x milestone Oct 6, 2026
@adamsitnik adamsitnik added the Servicing-consider Issue for next servicing release review label Oct 6, 2026
@adamsitnik
adamsitnik marked this pull request as ready for review October 6, 2026 08:44
@adamsitnik adamsitnik changed the title [release/10.0] Fix silent fsync errors on Linux [release/10.0] Fix operator precedence bug in SystemNative_FSync causing silent fsync errors Oct 6, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/area-system-io
See info in area-owners.md if you want to be subscribed.

@adamsitnik

Copy link
Copy Markdown
Member

/ba-g unrelated failures (flaky networking tests and high rate dead letter)

image

@ViveliDuCh

Copy link
Copy Markdown
Member

Hi,

the code complete date for 10.0.14 (the November 2026 release) is Monday 12 October. Make sure to merge this PR on that date at the latest, or it won't make it into that release.

As a reminder, if this is a product change, you also need Tactics approval before merging this PR (test-only or infra-only changes don't require Tactics approval).

Happy to help with the merge if needed!

@adamsitnik

Copy link
Copy Markdown
Member

@rbhanda the PR got approved via email, could you please apply the label?

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-System.IO Servicing-consider Issue for next servicing release review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants