News for hackers. Stuff that matters.
Re:File Expiration Using BPF by derobert on Monday March 27, 2023 @03:09AM (#35323730)
Here you probably want fanotify, not inotify. The later would require setting up a lot of inotify entries, recursing through the filesystem.

https://man7.org/linux/man-pages/man7/fanotify.7.html

I think fanotify does xattrs, but I haven't tested.

Re:File Expiration Using BPF by javierhonduco on Monday March 27, 2023 @03:29AM (#35323877)
Exactly this. I should have mentioned it in the post. Might amend it.

Would be interesting to compare the chances of race conditions with inotify vs BPF for this contrived use-case.

Re:File Expiration Using BPF by ec109685 on Monday March 27, 2023 @06:04AM (#35324792)
Just curious why you wouldn’t amend it?

Doesn’t take away from the original point that bpf is cool.

Re:File Expiration Using BPF by OJFord on Monday March 27, 2023 @07:23AM (#35325268)
Because it's from 2020/21, not even like it's a factual error, and OP may not have the interest to revisit it?
Re:File Expiration Using BPF by patrakov on Monday March 27, 2023 @05:39AM (#35324663)
I would still think that eBPF is a better suited approach. With fanotify, you would need to manage the mount points for which notifications need to be received. This works semi-OK for a static use case, but not for dynamically-created mounts and, worse, mount namespaces. In other words, fanotify is not suitable at all, without a lot of glue, for monitoring events happening in containers. And, for example, clamonacc (on-access file checking for ClamAV) does not work with removable storage, temporary network mounts, and containers for this very reason.