Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
os: fix race condition in readdir by atomically initializing dirinfo
This change ensures that dirinfo in the File struct is initialized atomically, avoiding redundant allocations when multiple goroutines access it concurrently. Instead of creating separate buffers, we now use CompareAndSwap to guarantee thread-safe initialization and reduce unnecessary memory usage. Although this is not a strict race condition, the update enhances efficiency by eliminating duplicate allocations and ensuring safer concurrent access. Fixes #71496. Change-Id: If08699a94afa05611cdf67e82a5957a8d8f9d5c8 GitHub-Last-Rev: 1e1f619 GitHub-Pull-Request: #71501 Reviewed-on: https://go-review.googlesource.com/c/go/+/645720 Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
- Loading branch information