Skip to content

Work around SMB lease loss when opening recovery ledger chunks - #8072

Merged
achamayou merged 5 commits into
microsoft:mainfrom
achamayou:workaround/rename-smb-lease-break-workaround
Jul 16, 2026
Merged

Work around SMB lease loss when opening recovery ledger chunks#8072
achamayou merged 5 commits into
microsoft:mainfrom
achamayou:workaround/rename-smb-lease-break-workaround

Conversation

@achamayou

@achamayou achamayou commented Jul 16, 2026

Copy link
Copy Markdown
Member

Summary

Replaces #8071.

This keeps the close/rename/reopen workaround for the Linux CIFS lease bug affecting Confidential Azure Container Instances, while restructuring and validating it for easier removal once the platform kernel contains upstream fix 2c7d399e551c.

Compared with #8071, this PR:

  1. Factors the optional close/reopen sequence into LedgerFile::rename(). Recovery finalization opts in, while the ordinary commit call site does not. Keeping the workaround behind one flag reduces duplication and makes it straightforward to remove after the kernel rollout.
  2. Strengthens the recovery tests to prove that enabling the flag actually closes the original open file description and opens a replacement. The tests use a Linux flock sentinel, which rename alone preserves but close/reopen releases; Close and reopen active recovery ledger chunks to preserve SMB write-caching #8071's descriptor-count and post-write checks do not distinguish those behaviors.
  3. Adds a Picobench comparison of rename with and without close/reopen for empty files, files containing 10,000 entries, and 1 MiB, 10 MiB, and 100 MiB files. The benchmark runs in the ACI SNP Milan and Genoa CI jobs, where verbose CTest output writes the CSV results to the workflow log.

Only uncommitted recovery chunks are closed and reopened. Committed recovery chunks remain immutable and rename-only. Close, rename, and reopen failures on the recovery-finalization path are fail-stop.

Verification

  • ledger_test: passed
  • ledger_bench: passed
  • C++/CMake/Prettier/release-note formatting: passed
  • ASCII and copyright checks: passed

Benchmark results

Times are per rename; overhead is close/reopen divided by rename-only.

Platform Kernel / filesystem Fixture Rename only Close/reopen Overhead
Local dev container Linux 6.8.0-1052-azure, ext filesystem Empty 28.3 us 42.9 us 1.51x
Local dev container Linux 6.8.0-1052-azure, ext filesystem 10,000 entries 32.8 us 47.7 us 1.46x
Local dev container Linux 6.8.0-1052-azure, ext filesystem 1 MiB 28.9 us 41.9 us 1.45x
Local dev container Linux 6.8.0-1052-azure, ext filesystem 10 MiB 29.8 us 42.4 us 1.42x
Local dev container Linux 6.8.0-1052-azure, ext filesystem 100 MiB 33.1 us 48.0 us 1.45x
ACI SNP Milan ACI container, overlay filesystem Empty 9.5 us 17.6 us 1.85x
ACI SNP Milan ACI container, overlay filesystem 10,000 entries 10.1 us 18.3 us 1.81x
ACI SNP Milan ACI container, overlay filesystem 1 MiB 10.0 us 18.9 us 1.89x
ACI SNP Milan ACI container, overlay filesystem 10 MiB 10.7 us 19.2 us 1.80x
ACI SNP Milan ACI container, overlay filesystem 100 MiB 11.5 us 21.2 us 1.84x
ACI SNP Genoa ACI container, overlay filesystem Empty 7.9 us 14.3 us 1.80x
ACI SNP Genoa ACI container, overlay filesystem 10,000 entries 8.9 us 15.4 us 1.74x
ACI SNP Genoa ACI container, overlay filesystem 1 MiB 8.6 us 15.2 us 1.76x
ACI SNP Genoa ACI container, overlay filesystem 10 MiB 9.6 us 16.7 us 1.74x
ACI SNP Genoa ACI container, overlay filesystem 100 MiB 11.4 us 18.5 us 1.63x

ACI measurements are from the CSV output in CI run 29490972468.

Copilot AI review requested due to automatic review settings July 16, 2026 10:09
@achamayou
achamayou requested a review from a team as a code owner July 16, 2026 10:09

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors and hardens the recovery-ledger rename workaround for an SMB/CIFS client lease-loss bug (affecting Confidential Azure Container Instances), by centralising the optional close/rename/reopen sequence inside LedgerFile::rename() and validating the behaviour with stronger tests and benchmarks.

Changes:

  • Add a close_and_reopen option to LedgerFile::rename() and enable it specifically for recovery finalisation (complete_recovery()), keeping ordinary commit behaviour unchanged.
  • Strengthen recovery unit tests to prove the active recovery chunk’s open file description is actually replaced (using a flock sentinel).
  • Add a Picobench benchmark for rename-with/without-close+reopen across multiple file sizes, and run it in SNP CI jobs with CSV output in logs.

Custom instructions used:

  • .github/copilot-instructions.md
  • .github/instructions/reviewing.instructions.md

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/host/ledger.h Adds LedgerFile::close() helper and extends LedgerFile::rename() to optionally close+reopen for recovery finalisation.
src/host/test/ledger.cpp Adds flock-based assertions to validate close+reopen behaviour during complete_recovery().
src/host/test/ledger_bench.cpp New Picobench benchmark comparing rename-only vs close+rename+reopen across several fixtures/sizes.
CMakeLists.txt Registers the new ledger_bench picobench target.
CHANGELOG.md Documents the temporary CIFS/SMB workaround and references the PR number.
.github/workflows/ci.yml Runs ledger_bench in SNP CI jobs with verbose output for CSV results.

Comment thread src/host/ledger.h Outdated
Comment thread src/host/ledger.h
@achamayou
achamayou merged commit 0f173e2 into microsoft:main Jul 16, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bench-ab run-long-test Run Long Test job

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants