Uh oh!
There was an error while loading. Please reload this page.
std.Build.Watch: key fanotify file descriptors by mount id - #24113
Conversation
Since marks are limited to a single filesystem. Context: ziglang#20670 Original pull request: ziglang#20672 Co-authored-by: Maciej 'vesim' Kuliński <vesim809@pm.me>
andrewrk
commented
Jun 23, 2025
Nice work, thanks! |
I’m still getting the error because it re-mounts |
(I'm out for the next few weeks so I won't be able to take a closer look for now.) I'm not sure I understand your setup with the information you've pasted. Do I understand correctly that your source files are under |
Profpatsch
commented
Jul 15, 2025
How do I see the mount ID for a mountpoint? |
Profpatsch
commented
Jul 15, 2025
Ah, after reading the manual: So the bind-mount has a different MountID |
Profpatsch
commented
Jul 15, 2025
The error description of
But I think it gets thrown because I’m using btrfs, and as always btrfs is a special little snowflake when it comes to syscall behaviour on Linux. Maybe a solution here could be to create a different watch group? |
Profpatsch
commented
Jul 15, 2025
I think I figured it out; I wasn’t aware that SO I think the way to do this is to catch that EXDEV error and provide an error message that includes a hint, or alternatively fall back to the |
kevinboulain
commented
Jul 15, 2025
If it helps to pinpoint the root cause on your side, I've tested this patch with Zig's stdlib in the Nix store on its own Btrfs subvolume and my project's source directory on another Btrfs subvolume, and, IIRC, under Linux 6.15. That's why I asked about your setup because yours doesn't seem to actually involve multiple filesystems so it's a bit confusing you're hitting this error (it might not even be necessary to key by mount id since it seems to be the same underlying filesystem in your case).
is fair since there's already a precedent: Line 187 in 0cb558b |
Profpatsch
commented
Jul 18, 2025
Okay, so, I updated to a newer kernel and now the fanotify watch works as expected. |
I hope it's okay to take over the inactive pull request #20672. The patch is very similar but I've taken into account the review comments: since indices correspond between the 'public'
DirTableand 'private' (to the Linux implementation)HandleTableI've stashed the mount point information in there. However, the Windows implementation is quite similar and sharesmarkAllFilesDirtyso I had to add a small edge case, not sure what you'll think of it.I've been using Zig for the past two weeks so apologies if I'm not following conventions. I've tested my change by following the wiki and since I'm on NixOS I'm hitting this problem immediately (same error message as #20670).
Fixes#20670.
Closes#20672.