LWN: Comments on "Change notifications for network filesystems" https://lwn.net/Articles/896055/ This is a special feed containing comments posted to the individual LWN article titled "Change notifications for network filesystems". en-us Wed, 17 Sep 2025 20:07:51 +0000 Wed, 17 Sep 2025 20:07:51 +0000 https://www.rssboard.org/rss-specification lwn@lwn.net Change notifications for network filesystems https://lwn.net/Articles/954186/ https://lwn.net/Articles/954186/ bonassis <div class="FormattedComment"> Hi.<br> <p> Good to see there is attention for fsnotify methods (inotify, fanotify) and network filesystems. Earlier I've been pretty busy why this does not work on Linux, and wrote this about it (only FUSE):<br> <p> <a rel="nofollow" href="https://github.com/libfuse/libfuse/wiki/Fsnotify-and-FUSE">https://github.com/libfuse/libfuse/wiki/Fsnotify-and-FUSE</a><br> <p> One citation about why it does not work: "In short: the individual filesystems do not "know" a watch has been set, and thus cannot react on that."<br> I've written some patches back then, which made the fsnotify subsystem in Linux informs the VFS fuse kernel module when a watch has been set (or changed or removed). That worked, but later I came to the conviction that handling of this is far better of in userspace, than in the kernel.<br> <p> In network filesystems, you are working in an network enviroment right? And when you want fsnotify to work in an network environment, it's because you want that applications like a filemanager, but also officesuites for example are informed about changes made by others, on other hosts (because changes made on the same host you are working on does work ...). <br> Now I think that users are not only interested in seeing a simple event like a file is created in a watched folder, but also by who (a user in username@domain.org notation) from what host. You can do a lot in the kernel, but you can never let a network filesystem in the kernel pass through this information. A better way to do this is doing this in userspace. <br> <p> Some time ago there was a special service for that (FAM = File Alteration Monitor) but that is not used anymore.<br> <p> The way it should work in my opinion:<br> - there is a dedicated service which offers a fs change notify service to applications<br> - applications can ask (via mask) what info they want: apart from pretty standard events like a file is added, removed or changed/modified, also by who, from what host and time.<br> - this service checks the filesystem the watch has been set upon: if its a not a networkfs and not a fuse fs use the native fs method, which is fanotify at this moment for Linux. This method provides ways to determine who (via pid) caused the event.<br> - when dealing with a FUSE fs, the daemon is running in userspace, then it should be not so hard to forward the watch request to this daemon. This daemon can than (if it supports this, otherwise fallback to default which is fanotify) reply what info it can handle, and possibly provide the information when an event on the backend occurs.<br> <p> I'm working in a set of software (OSNS, <a rel="nofollow" href="https://github.com/stefbon/OSNS">https://github.com/stefbon/OSNS</a>) based upon the SSH protocol, MDNS and FUSE and this is doable.<br> With a network filesystem in the kernel (cifs) this is harder. <br> <p> I'm very interested in what you think,<br> <p> best regards,<br> <p> S. Bon<br> the Netherlands<br> <p> <p> </div> Sat, 09 Dec 2023 14:25:52 +0000 Change notifications for network filesystems https://lwn.net/Articles/896581/ https://lwn.net/Articles/896581/ mtodorov IMHO, from the security point of view, it would be very useful i.e. to know which user is trying to modify /bin/bash on local filesystem. If this is a user named jdoe@localhost, and he is not one of the admins, then Huston we have a problem! <p> IMNSHO, the network file system's integrity should be the responsibility of the NSF, SMB or other server ... <p> A process could request (for example) <code><b>IN_EVENT_UID</b></code> in the list of events listened to, and the fs driver could reply with <code>EINVAL</code> or perhaps even more distinctive <code><b>EREMOTE</b></code> (Object is remote). Mon, 30 May 2022 11:07:23 +0000 Change notifications for network filesystems https://lwn.net/Articles/896579/ https://lwn.net/Articles/896579/ taladar <div class="FormattedComment"> Wouldn&#x27;t that be difficult for network filesystems in particular. You don&#x27;t really have uids that are the same across the whole network filesystem scope (server + all clients).<br> </div> Mon, 30 May 2022 09:15:22 +0000 Change notifications for network filesystems https://lwn.net/Articles/896562/ https://lwn.net/Articles/896562/ mtodorov P.S. <p> Please pardon my typo and imprecision, this should say: <p> "It doesn't seem to have to break anything, since programs rely on <code>event_len</code> rather than <code>sizeof (struct fanotify_event_metadata)</code> to get data." Sun, 29 May 2022 21:58:06 +0000 Change notifications for network filesystems https://lwn.net/Articles/896561/ https://lwn.net/Articles/896561/ mtodorov It is however disabling not to know which user attempted to open or access a file, or caused file event. <p> The prudent approach may be to add uid, gid, real and effective user ids to the structure: <pre> struct fanotify_event_metadata { __u32 event_len; __u8 vers; __u8 reserved; __u16 metadata_len; __aligned_u64 mask; __s32 fd; __s32 pid; }; </pre> It doesn't seem to have to break anything, since programs rely on even_len rather than sizeof (struct fanotify) to get data. <p> Rationale: it is possible to lookup which user is the owner of the PID, however, while that information is being searched for, the process may exit already. <p> It also involves a race condition. And it may not be the same which user we give an access to file to. Lookup in /proc file system is expensive and inefficient. :-( <p> My $0.02. Sun, 29 May 2022 21:37:56 +0000 Change notifications for network filesystems https://lwn.net/Articles/896428/ https://lwn.net/Articles/896428/ Fowl <div class="FormattedComment"> It seems remarkable to me that there doesn’t seem to be an abstraction on the user space APIs in the VFS layer? Or is the overlap in functionality so small that it wouldn’t be worth it?<br> </div> Fri, 27 May 2022 09:05:32 +0000 Change notifications for network filesystems https://lwn.net/Articles/896401/ https://lwn.net/Articles/896401/ Kamilion <div class="FormattedComment"> Wait a second, I thought we &#x27;got rid&#x27; of inotify *years* ago by stubbing it out to call fanotify?<br> </div> Thu, 26 May 2022 20:53:04 +0000