[PR #438] [MERGED] fix: avoid nested image state read locks during writes #440

Closed
opened 2026-10-29 14:23:26 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/kvcache-ai/AgentENV/pull/438
Author: @huang-jl
Created: 10/26/2026
Status: ✅ Merged
Merged: 10/27/2026
Merged by: @yingdi-shan

Base: main ← Head: hjl/fix-image-file-nested-read-lock


📝 Commits (1)

  • b74a523 fix: avoid nested image state read locks during writes

📊 Changes

1 file changed (+99 additions, -13 deletions)

View changed files

📝 storage/overlaybd/src/image/image_file.rs (+99 -13)

📄 Description

What

Reuse the existing state read guard when refreshing size metadata after writes, discards, and truncations, including io-uring write paths. Inline refresh_size_metadata() into size() and add a deterministic regression test.

Why

Tokio’s fair RwLock queues new readers behind waiting writers. Previously, these operations held a read lock while requesting another, which could deadlock if a snapshot queued a write lock between them. Reusing the existing guard removes that circular wait while keeping the operation and metadata update protected.

Design and behavior changes

No behavior changes for users.

Compatibility and operations

No compatibility issues.

Validation

  • make fmt
  • make clippy
  • make test-unit
  • Relevant Rust integration tests
  • make -C services test (required when services/ changes)
  • Generated clients/server regenerated with the documented make target
  • Documentation updated
  • Benchmarks or performance comparison completed

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/kvcache-ai/AgentENV/pull/438 **Author:** [@huang-jl](https://github.com/huang-jl) **Created:** 10/26/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@yingdi-shan](https://github.com/yingdi-shan) **Base:** `main` ← **Head:** `hjl/fix-image-file-nested-read-lock` --- ### 📝 Commits (1) - [`b74a523`](https://github.com/kvcache-ai/AgentENV/commit/b74a523ec3ff8739e3d1323e9448505b1298cc64) fix: avoid nested image state read locks during writes ### 📊 Changes **1 file changed** (+99 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `storage/overlaybd/src/image/image_file.rs` (+99 -13) </details> ### 📄 Description ## What Reuse the existing state read guard when refreshing size metadata after writes, discards, and truncations, including io-uring write paths. Inline `refresh_size_metadata()` into `size()` and add a deterministic regression test. ## Why Tokio’s fair `RwLock` queues new readers behind waiting writers. Previously, these operations held a read lock while requesting another, which could deadlock if a snapshot queued a write lock between them. Reusing the existing guard removes that circular wait while keeping the operation and metadata update protected. ## Design and behavior changes No behavior changes for users. ## Compatibility and operations No compatibility issues. ## Validation <!-- Check only commands you actually ran. Add focused tests and exact commands below. --> - [x] `make fmt` - [x] `make clippy` - [x] `make test-unit` - [ ] Relevant Rust integration tests - [ ] `make -C services test` (required when `services/` changes) - [ ] Generated clients/server regenerated with the documented `make` target - [ ] Documentation updated - [ ] Benchmarks or performance comparison completed --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 14:23:26 +00:00
Sign in to join this conversation.
No milestone
No project
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.

Dependencies

No dependencies set.

Reference
kvcache-ai/AgentENV#440
No description provided.