-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fantoify fsid mark failing for btrfs subvolumes: Invalid cross-device link #3
Comments
This currently fails on btrfs which does not support `FAN_MARK_FILESYSTEM` and returns EXDEV [1]. Fixes #3 [1] https://github.com/torvalds/linux/blob/7d6beb71da3cc033649d641e1e608713b8220290/fs/notify/fanotify/fanotify_user.c#L1075
No, which one is that? The CI here runs on GitHub workflows, which is Ubuntu 20.04 on ext4 (... I guess), and it is happy. So that means that I added a possible fix to https://github.com/martinpitt/fatrace/tree/btrfs , want to try that? I won't land it yet, I want to try and reproduce this in a test (on a loop device). |
I just added a test for btrfs, on a loop device. This works fine, and also that's not too surprising -- after alll, there is nothing cross-device there. I figure you have something slightly more fancy? Subvolumes? /home being a symlink or bind-mount or something? |
doh ya. / and /home are two subvolumes on the same device the failing test was CI, one of the containers. called "btrfs tests" now (don't remember if it was at the time) as for the btrfs branch: it does the same thing fatrace did before the patch, runs but there's no events from / or /home the thing that made it confusing is that fatrace runs and doesn't exit, it just didn't print any events for the expected filesystems (when run with no options) it sees and sets up monitors on squashfs files snap has mounted, but the events on those filesystems are relatively rare so it wasn't easy to see that was the case don't know much about fanotify but if there are filesystems or mounting scenarios where a combination of flags won't work it would be useful to have a way for fatrace to say so, like printing a table of all the filesystem watches and the actual flags being used. and maybe a strict/loose option to make fatrace exit when the flags you ask for can't be done on the filesystem(s) that leaves the door open for running fatrace with no options and showing some events on btrfs and more where it is able (which is 99% of my use-case, just to take a peek at what's going on) thank you for looking into this |
sorry for the delay, here's everything it says in debug mode before pausing for lack of filesystem activity: [ohsix@pro fatrace]$ sudo ./fatrace |
any news on this? if it helps the expected behavior of -c is also busted :)
this is a default fedora install with the default volume manager / btrfs options, gnome-boxes can download the iso and install it for you pretty quick. or if there's anything i can collect here please let me know |
Sorry for the delay! I see this as well now on a Fedora 35 cloud image, which uses btrfs with subvolumes. This is also easy to reproduce with the integration test: --- a/tests/fatrace-btrfs
+++ b/tests/fatrace-btrfs
@@ -16,7 +16,9 @@ mkdir -p "$MOUNT"
mount -o loop "$IMAGE" "$MOUNT"
trap "umount -l '$MOUNT'" EXIT INT QUIT PIPE
-cd "$MOUNT"
+btrfs subvolume create "$MOUNT/subv1"
+
+cd "$MOUNT/subv1"
echo "hello" > world.txt However, I'm afraid I wouldn't know what to do here.. both the new and old Note that the "pausing for lack of fs activity" only happens if you run it without options -- as long as there is at least one watched fs, it will wait for that. With e.g. |
Ah, it's not actually that bad.. I can run Now, I realize that does not help much if you only have subvolumes mounted, and not the root device -- but it seems this is the best that Linux can do. |
i think I can adapt to that, thank you for looking into it i looked at the man pages again and they do remark about EXDEV/NODEV & btrfs, here's where it was added https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/man2/fanotify_mark.2?id=0a4db6dc742d9150d73048e889de9e6accc53d46 can see that it might be a semantic change but i don't know any of this well enough to say that it could work like it did before |
It seems to be a popular choice for distros to use subvolumes by default now on btrfs, even Debian's default of putting everything in an A quick and dirty workaround is to mount the root of the root partition (i.e. mount without |
I don't often mount things by UUID; leaving this here in case it is helpful for others:
|
Hi, I'm a bit lost here, and I can not use fatrace at all on btrfs. All my mounts are in subvolumes, the However, from the above I underestod I need to mount the default subvolume somewhere else, but perhaps what was meant to say, is I need to mount the top-level subvolume? Either way, after running
And fatrace can not producing any output at all.
This is on 0.17.0-1 installed from AUR. I should probably add that the subvolume layout is quite complex; every user has own subvolumes in /home, and many subvolumes have automated snapshots (subvolumes in .subvolume subvolume). |
Yes, as far as I understand it needs to be the top-level subvolume:
Does
This is what it looks like for me, after mounting with the above command:
So it looks like it is using the I don't think this is the same as the
hope this helps! Also, make sure you do |
Thanks, I will try wit the root volume later. I'm not sure how fstab is relevant here (or were you replying to someone else?). I've se the default sobvolume with
which is a bit confusing, but as "without subvol" can be really anything, so that's not what is actually meant here. EDIT: Indeed what needs to be done is to mount the root, not the default. It's quite obvious if one reads carefully the earlier discussion, the only cause of confusion is the quote above, as indeed the root might not be the default. |
probably already know this from the failing test but,
fanotify_test_fid returns -EXDEV on btrfs
https://github.com/torvalds/linux/blob/7d6beb71da3cc033649d641e1e608713b8220290/fs/notify/fanotify/fanotify_user.c#L1075
the older version without FAN_REPORT_FID was working until I upgraded the os
The text was updated successfully, but these errors were encountered: