[systemd-devel] [PATCH] Re: fstab mounts get unmounted during boot (.device unit bouncing?) -- solution

Martin Pitt martin.pitt at ubuntu.com
Thu Feb 12 03:40:25 PST 2015


Hey Karel,

Karel Zak [2015-02-12 12:25 +0100]:
> > -        r = mnt_table_parse_mtab(tb, NULL);
> > +        r = mnt_table_parse_mtab(tb, "/proc/self/mountinfo");
> 
> 
> This is bad solution. It resolves the issue, but forces libmount to
> not read /run/mount/utab.

Can you please explain why? As far as I can see,
__mnt_table_parse_mtab() only skips reading /run/mount/utab if
reading /proc/self/mountinfo fails and it falls back to reading
/proc/mounts (as it immediately returns there in all cases, not just
in the failure case). This is probably unintended and a bug.

But we shouldn't actually hit that here, as we actually do expect
/proc/self/mountinfo to exist (systemd references it in a gazillion
places).

I. e. whether you pass NULL or "/proc/self/mountinfo" should not make
a difference if /etc/mtab is a symlink to /proc (as it should be the
case on every systemd installation) -- this patch would simply be a
no-op, as it would run the same code paths in libmount with and
without the patch. And if /etc/mtab is a file, then without the patch
it does mnt_table_parse_file(/etc/mtab) and then parses the utab, and
with the patch it parses /proc/self/mountinfo and then the utab.

So what goes wrong here?

Thanks,

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)


More information about the systemd-devel mailing list