[systemd-devel] [PATCH v2 5/5] mount: auto-detect iSCSI and FCoE as requiring network

Karel Zak kzak at redhat.com
Fri Dec 12 14:54:37 PST 2014


On Fri, Dec 12, 2014 at 08:11:54PM +0100, Lennart Poettering wrote:
> On Fri, 05.12.14 15:54, Karel Zak (kzak at redhat.com) wrote:
> > I guess it's enough to add the 'fd' to systmed sd_event_add_io() and
> > call mnt_table_parse_mtab() when a change is detected. (As already
> > implemeted in the original Chris' patch.)
> 
> Karel, if I got this right, then the new monitor stuff will only wrap
> inotify on utab, right?

Right.

> I think it would be useful if it would also
> abstract notifications via /proc/self/mountinfo in it. To make the

I have had plan to add mnt_monitor_kernel_get_fd().

> interface easy for this and to be able to just hand out a single fd,
> this would mean creating an epoll fd inside the lib, then adding the
> inotify fd for utab to it, and then on top the EPOLLPRI watch on
> /proc/self/mountinfo.
>
> This way apps would get the full set of notifications via your
> library, without knowing what's going on underneath, and userspace
> notifications and kernel notifications would come the same way. 

I don't want provide only high-level abstraction, sometimes it's
useful for developers to have access to low-level things (for example
sometimes utab monitoring is unnecessary overkill). 

It's also possible that in future there will be more things to monitor
(mountinfo in another namespaces, FS specific things, ...etc).

Maybe the API should be extended to something like:

  mnt_monitor_enable_userspace(mn, TRUE);
  mnt_monitor_enable_kernel(mn, TRUE);

  fd = mnt_monitor_get_fd(mn);

where 'fd' is the top level file descriptor to monitor all enabled
things.

Hmm... OK, next week ;-)

    Karel

-- 
 Karel Zak  <kzak at redhat.com>
 http://karelzak.blogspot.com


More information about the systemd-devel mailing list