Skip to content

fix: remap fh_in and fh_out independently for CopyFileRange/RemapFileRange#551

Closed
claude-claude[bot] wants to merge 1 commit intofuse-pipe-restorefrom
claude/fix-22647642460
Closed

fix: remap fh_in and fh_out independently for CopyFileRange/RemapFileRange#551
claude-claude[bot] wants to merge 1 commit intofuse-pipe-restorefrom
claude/fix-22647642460

Conversation

@claude-claude
Copy link
Copy Markdown
Contributor

@claude-claude claude-claude bot commented Mar 3, 2026

Auto-Fix for PR #549

Issues Fixed

  1. [MEDIUM] with_fh() corrupts fh_out for dual-handle operations — The previous fix (commit 13526d1) set both fh_in and fh_out to the same value in with_fh(), corrupting the other handle when only one is stale. Now with_fh() only updates fh_in, and new fh_out()/ino_out()/with_fh_out() helpers allow independent remapping. Both the handle_remap lookup and EBADF retry paths now remap each handle separately.

  2. [LOW] Silent JSON parse failure in restore_from_tableserde_json::from_str(json).unwrap_or_default() silently discarded corrupt inode table JSON. Now logs a warn! so operators can diagnose restore failures.

Changes

  • fuse-pipe/src/protocol/request.rs: with_fh() no longer touches fh_out; added fh_out(), ino_out(), with_fh_out() helpers
  • fuse-pipe/src/server/remap.rs: Handle remap lookup and EBADF retry now remap fh_out independently; added warn import and parse failure logging

Generated by Claude | Review Run

…Range

The previous fix set both fh_in and fh_out to the same value in with_fh(),
which corrupts fh_out when only fh_in is stale (or vice versa). Split into
independent fh_out()/ino_out()/with_fh_out() helpers so the handle_remap
lookup and EBADF retry paths remap each handle separately.

Also log a warning when restore_from_table fails to parse inode table JSON
instead of silently falling back to an empty table.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 71341fe6bb

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +744 to +748
if let (Some(old_fh_out), Some(stable_ino_out)) =
(request.fh_out(), request.ino_out())
{
if let Some(new_fh_out) =
self.try_reopen_handle(stable_ino_out, old_fh_out, false)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reopen fh_out only when it is actually stale

This block unconditionally calls try_reopen_handle for fh_out on every EBADF retry, even when EBADF was caused by fh_in and fh_out is already a valid current handle (a common mixed-handle state after snapshot restore). In that case try_reopen_handle inserts a new mapping for the valid old_fh_out, so later requests are remapped to a duplicate descriptor; when Release arrives, the remapped descriptor is closed and the original valid handle is never released, causing an FD leak that can accumulate over long-running workloads.

Useful? React with 👍 / 👎.

@ejc3
Copy link
Copy Markdown
Owner

ejc3 commented Mar 3, 2026

Already fixed in latest commits — with_fh() only remaps fh_in now

@ejc3 ejc3 closed this Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant