Skip to content

external: normalize file id lookup and warn on fallback reopen#2992

Open
cheese-cakee wants to merge 1 commit intocheckpoint-restore:criu-devfrom
cheese-cakee:fix/issue-2951-external-lookup
Open

external: normalize file id lookup and warn on fallback reopen#2992
cheese-cakee wants to merge 1 commit intocheckpoint-restore:criu-devfrom
cheese-cakee:fix/issue-2951-external-lookup

Conversation

@cheese-cakee
Copy link
Copy Markdown
Contributor

Why this PR is necessary

External regular-file restore can behave inconsistently when the same file[mnt_id:inode] is written in different numeric forms (for example decimal in one place and 0x form in another). In that case, mapping lookup may miss a logically identical external file id and restoration falls back unexpectedly.

This PR makes matching robust for equivalent numeric ids and improves diagnostics when fallback is used.

What this PR changes

  • Normalize parsing of file[mnt_id:inode] during external id lookup so decimal and 0x forms are treated as equal by value.
  • Preserve exact string-match as fast path.
  • Add a warning when no --inherit-fd mapping is found for an external file id and restore falls back to reopen-by-path.
  • Clarify CLI/docs text that mnt_id and inode in file[mnt_id:inode] may be decimal or 0x hex.

Scope

  • Single logical change.
  • No unrelated modifications.

Testing

  • git diff --check HEAD~1..HEAD
  • python3 -m py_compile test/zdtm.py test/zdtm/criu_config.py

Copilot AI review requested due to automatic review settings March 29, 2026 16:34
Copy link
Copy Markdown

Copilot AI left a comment

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 aims to make external regular-file id matching more robust across equivalent numeric representations (decimal vs hex) and improve restore diagnostics when CRIU falls back from --inherit-fd to path-based reopen.

Changes:

  • Add normalization logic for file[mnt_id:inode] matching in external id lookup (keeping exact string compare as a fast path).
  • Emit a warning during restore when an external file has no --inherit-fd mapping and CRIU falls back to reopening by path.
  • Update CLI help and documentation to describe accepted numeric formats for file[mnt_id:inode].

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
criu/files-reg.c Adds a warning when --inherit-fd mapping is missing for an external file.
criu/external.c Introduces parsing/normalization for file[mnt_id:inode] during external id lookup.
criu/crtools.c Updates --external / --inherit-fd help text for file[mnt_id:inode] formats.
Documentation/criu.txt Clarifies documentation for --external file[mnt_id:inode] numeric formats.

@cheese-cakee cheese-cakee force-pushed the fix/issue-2951-external-lookup branch from a962016 to 11276ef Compare March 29, 2026 16:42
Signed-off-by: Farzan Aman Khan <farzanaman99@gmail.com>
@cheese-cakee cheese-cakee force-pushed the fix/issue-2951-external-lookup branch from 11276ef to 7bf7613 Compare March 29, 2026 16:52
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.

2 participants