[systemd-devel] [RFC] Integrate export mount command in code

Dave Reisner d at falconindy.com
Sun Aug 17 14:41:38 PDT 2014


On Mon, Aug 18, 2014 at 12:25:00AM +0300, Timofey Titovets wrote:
> Good time of day, i just want to ask:
> Systemd depend on util-linux mount command and in code we call him,
> may have a sense to import and cleanup code to systemd base, and just
> call function in systemd, instead of using mount command?
> 
> But only benefit what i see:
> it faster, when call external command, but i can miss something

tl;dr: this simply isn't a good idea, as it would require reimplementing
a substantial amount of code to retain feature parity.

systemd already uses mount(2) where it's reasonable: kernel filesystems
like /sys, /dev, and /proc.

Some reasons not to do this for all filesystems:

1) You have to fork, anyways, because you don't want to call mount(2)
from PID 1 -- the syscall may not return for a relatively long period of
time.  During this time, systemd will be entirely non-responsive.
2) Mounting filesystems is sometimes complex, and involves an external
helper, regardless. fuse, cifs, and nfs immediately come to mind, but
there's others. mount(8) knows how to find and execute these when
necessary.
3) mount(8) takes care of cleaning the option string from /etc/fstab --
not all options are meant to be passed to the kernel (or the external
mount helpers), such as any option which starts with "x-" (like
x-systemd.automount).

Cheers,
d


More information about the systemd-devel mailing list