|
|
Subscribe / Log in / New account

watch_mount(), watch_sb(), and fsinfo() (again)

watch_mount(), watch_sb(), and fsinfo() (again)

Posted Feb 25, 2020 4:32 UTC (Tue) by anguslees (subscriber, #7131)
Parent article: watch_mount(), watch_sb(), and fsinfo() (again)

Is netlink an acceptable alternative to the proposed notification pipe, or are the required semantics different?


to post comments

watch_mount(), watch_sb(), and fsinfo() (again)

Posted Feb 25, 2020 7:00 UTC (Tue) by smurf (subscriber, #17840) [Link] (8 responses)

Regardless of whether netlink would be a good way to do it, this is yet another way to get a string of notifications from the kernel. I do wonder why nobody is complaining loudly that this should use, or maybe improve upon, one of the existing mechanisms.

watch_mount(), watch_sb(), and fsinfo() (again)

Posted Feb 25, 2020 10:11 UTC (Tue) by Cyberax (✭ supporter ✭, #52523) [Link] (1 responses)

Yes, I actually wanted to ask the same. Why not extend fanotify?

watch_mount(), watch_sb(), and fsinfo() (again)

Posted Feb 25, 2020 14:38 UTC (Tue) by alison (subscriber, #63752) [Link]

>Why not extend fanotify?

The author of "man fanotify" appears to have the same question:

The fanotify API provides notification and interception of filesystem events.
Use cases include virus scanning and hierarchical storage management. **Cur‐
rently, only a limited set of events is supported.**

watch_mount(), watch_sb(), and fsinfo() (again)

Posted Feb 25, 2020 22:36 UTC (Tue) by neilbrown (subscriber, #359) [Link] (3 responses)

This *is* an existing mechanism. autofs has been using a pipe for notification for decades.

watch_mount(), watch_sb(), and fsinfo() (again)

Posted Feb 26, 2020 7:24 UTC (Wed) by maxfragg (guest, #122266) [Link] (2 responses)

not sure if the fact that this existed so long without a lot of people noticing makes it better or worse.
But I have to agree, having one encouraged interface (probably netlink, or maybe even epoll here?) to be used for any new interface of this type would be a good idea

watch_mount(), watch_sb(), and fsinfo() (again)

Posted Feb 26, 2020 14:25 UTC (Wed) by Paf (subscriber, #91811) [Link]

This doesn’t really seem like a big deal - novel and different mechanisms are a problem when they’re, well, novel and different. This is just a pipe, and unless I’ve missed something, it’s not requiring implementing anything.

I mean maybe netlink would be superior, but this seems nicely trivial. It’s not like they’re knocking up a netlink competitor, just using a trivial interface where they can.

watch_mount(), watch_sb(), and fsinfo() (again)

Posted Feb 28, 2020 14:43 UTC (Fri) by dhowells (guest, #55933) [Link]

I'm trying to make a generic notification system, with such properties as:
- messages can be longer than 8 bytes (say up to 128 bytes);
- message queueing requires no on-the-spot allocation and can be done from softirq/irq context or inside spinlocks;
- messages can come from a variety of sources (e.g. mount(2), add_key(2), keyctl(2), sb errors, usb notifications, ...);
- messages from different sources can be in the same queue;
- messages may need copying into multiple queues;
- filters can be easily employed;
- message loss reporting.

As has been mentioned, there are existing solutions:
- Netlink:
- would make the core VFS dependent on the networking code.
- would require GFP_ATOMIC message allocation at the point of generation (at least sometimes).
- doesn't seem to make it easy to do message loss reporting.
- epoll is for dealing with file descriptors - but we're not dealing with fd events.
- Not all sources I need notifications for can be addressed with fanotify.
- eventfd() has 8-byte messages.

Pipes have disadvantages too: no message loss reporting (I'm having to add it); pipe ring buffer metadata elements generally larger than common messages (might be able to optimise in future to store small data in the ring). Note that I didn't want to use pipes either: I was originally using a mappable chardev ring buffer but Linus said I had to use pipes instead.

watch_mount(), watch_sb(), and fsinfo() (again)

Posted Feb 27, 2020 14:47 UTC (Thu) by kugel (subscriber, #70540) [Link] (1 responses)

There is also eventfd(2)

A pipe seems really awkward for one-way event notifications.

watch_mount(), watch_sb(), and fsinfo() (again)

Posted Feb 28, 2020 14:15 UTC (Fri) by dhowells (guest, #55933) [Link]

eventfd is limited to 8-byte messages. That is not sufficient.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds