Skip to content

Avoid inode-loop detection in tfork socket cleanup - #6

Open
shengqi-gensee wants to merge 1 commit into
gensee-tclonefrom
agent/walk-tfork-sockets
Open

Avoid inode-loop detection in tfork socket cleanup#6
shengqi-gensee wants to merge 1 commit into
gensee-tclonefrom
agent/walk-tfork-sockets

Conversation

@shengqi-gensee

Copy link
Copy Markdown

Summary

Replace tfork's external GNU find socket cleanup with Go's path-based
filepath.WalkDir.

OverlayFS can expose unrelated directories with the same device and inode.
GNU find interprets that collision as a filesystem loop, skips the affected
subtree, and leaves stale Unix sockets behind. WalkDir follows directory
paths without following symlinks, removes socket entries, and continues after
individual traversal or removal failures.

Add a regression test covering a nested Unix socket, preservation of regular
files, and non-traversal of a symlink outside the root.

Test plan

  • go test ./pkg/domain/infra/abi -run '^TestTforkPurgeSockets$' -count=1
    on the Phase 0 GCE VM with the custom kernel and build dependencies
  • Rebuilt Podman 5.8.2 on the Phase 0 VM
  • Ran the full two-copy tclone smoke test on Btrfs/OverlayFS:
    fork isolation, git merge, discard, and cleanup all passed
  • Confirmed the previous GNU find filesystem-loop warning no longer appears

Local compilation was not used because the development host lacks the GPGME
and Btrfs development headers required by this Podman package.

@shengqi-gensee
shengqi-gensee marked this pull request as ready for review July 29, 2026 01:35
@yiying-zhang

Copy link
Copy Markdown

The fix itself lgtm.

The new test covers the desired cleanup behavior, but not the actual OverlayFS inode-loop regression. A normal tempdir with a nested socket would also have worked with the old find -type s -delete implementation, so this is more of a semantic/unit test than a regression test for the reported root cause.

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