mountinfo: use statx in Mounted and MountedFast #281
All Vouch review confidence checks passed
Residual risk 0.19 = Change Risk (0.35) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.35 · 160 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.344
Diff Size
diff_size
0.304
Real PR Conversation Timeline
1 comments
"Review active on #281"
general
weight: 0.35
kolyshkin
Since Linux v5.8, statx(2) reports the
STATX_ATTR_MOUNT_ROOTattribute, which tells whether a path is the root of a mount. It works for all kinds of mounts, including bind mounts, and takes a single syscall.This PR makes it the first method tried by
MountedandMountedFast:filepath.Abs), not fully normalized: the kernel resolves symlinks itself, andfilepath.EvalSymlinks(an lstat per path component) was the most expensive part ofMounted...is still handled lexically, as before.AT_NO_AUTOMOUNTis used so that checking an automount point does not trigger the automount; this is consistent with the existing methods (verified with/sys/kernel/debug/tracingon tracefs).STATX_ATTR_MOUNT_ROOT, the existing chain (openat2 → stat → mountinfo) is used, so returned errors are unchanged.Result:
Mountedis about 10x faster (523 vs 5056 ns/op for a path with 6 components) 👯.Tests:
mountedByStatxis added toTestMountedBy(which covers bind mounts of dirs, files and sockets, symlinks, etc. when run as root), and a newTestMountedByStatxVsMountinfochecks it against every entry in mountinfo.