Bug 54285

Summary: Automatic mount point dependencies not always working
Product: systemd Reporter: Brian Johnson <bjthinks>
Component: generalAssignee: systemd-bugs
Status: RESOLVED FIXED QA Contact: systemd-bugs
Severity: normal    
Priority: medium CC: zbyszek
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Brian Johnson 2012-08-30 20:19:10 UTC
The man page for systemd.mount states: "If an mount point is beneath another mount point in the file system hierarchy, a dependency between both units is created automatically."

I tested this and could not verify correct behavior 100% of the time.  This is unfortunately an intermittent bug -- sometimes the implicit dependencies appear to work right, and sometimes not.

Here is a typical attempt.  The error occurs near the bottom -- the second time a-b.mount is started, the implicit dependency a.mount is left inactive.

$ uname -a
Linux arch 3.4.6 #6 SMP PREEMPT Fri Aug 17 15:13:25 PDT 2012 x86_64 GNU/Linux
$ systemctl --version
systemd 188
arch
+PAM -LIBWRAP -AUDIT -SELINUX -IMA -SYSVINIT +LIBCRYPTSETUP
$ pwd
/etc/systemd/system
$ cat a.mount
[Unit]
Description=A

[Mount]
What=tmpfs
Where=/a
Type=tmpfs
$ cat a-b.mount
[Unit]
Description=AB

[Mount]
What=tmpfs
Where=/a/b
Type=tmpfs
$ sudo systemctl daemon-reload
$ sudo systemctl status a.mount
a.mount - A
	  Loaded: loaded (/etc/systemd/system/a.mount; static)
	  Active: inactive (dead)
	   Where: /a
	    What: tmpfs
	  CGroup: name=systemd:/system/a.mount

$ sudo systemctl status a-b.mount
a-b.mount - AB
	  Loaded: loaded (/etc/systemd/system/a-b.mount; static)
	  Active: inactive (dead)
	   Where: /a/b
	    What: tmpfs
	  CGroup: name=systemd:/system/a-b.mount

$ sudo systemctl start a-b.mount
$ sudo systemctl status a.mount
a.mount - A
	  Loaded: loaded (/etc/systemd/system/a.mount; static)
	  Active: active (mounted) since Thu, 30 Aug 2012 13:11:23 -0700; 2s ago
	   Where: /a
	    What: tmpfs
	 Process: 4016 ExecMount=/bin/mount tmpfs /a -t tmpfs (code=exited, status=0/SUCCESS)
	  CGroup: name=systemd:/system/a.mount

$ sudo systemctl status a-b.mount
a-b.mount - AB
	  Loaded: loaded (/etc/systemd/system/a-b.mount; static)
	  Active: active (mounted) since Thu, 30 Aug 2012 13:11:23 -0700; 5s ago
	   Where: /a/b
	    What: tmpfs
	 Process: 4018 ExecMount=/bin/mount tmpfs /a/b -t tmpfs (code=exited, status=0/SUCCESS)
	  CGroup: name=systemd:/system/a-b.mount

$ sudo systemctl stop a.mount
$ sudo systemctl status a.mount
a.mount - A
	  Loaded: loaded (/etc/systemd/system/a.mount; static)
	  Active: inactive (dead) since Thu, 30 Aug 2012 13:11:47 -0700; 3s ago
	   Where: /a
	    What: tmpfs
	 Process: 4032 ExecUnmount=/bin/umount /a (code=exited, status=0/SUCCESS)
	 Process: 4016 ExecMount=/bin/mount tmpfs /a -t tmpfs (code=exited, status=0/SUCCESS)
	  CGroup: name=systemd:/system/a.mount

$ sudo systemctl status a-b.mount
a-b.mount - AB
	  Loaded: loaded (/etc/systemd/system/a-b.mount; static)
	  Active: inactive (dead) since Thu, 30 Aug 2012 13:11:47 -0700; 8s ago
	   Where: /a/b
	    What: tmpfs
	 Process: 4030 ExecUnmount=/bin/umount /a/b (code=exited, status=0/SUCCESS)
	 Process: 4018 ExecMount=/bin/mount tmpfs /a/b -t tmpfs (code=exited, status=0/SUCCESS)
	  CGroup: name=systemd:/system/a-b.mount

$ sudo systemctl start a-b.mount
$ sudo systemctl status a.mount
a.mount - A
	  Loaded: loaded (/etc/systemd/system/a.mount; static)
	  Active: inactive (dead)
	   Where: /a
	    What: tmpfs
	  CGroup: name=systemd:/system/a.mount

$ sudo systemctl status a-b.mount
a-b.mount - AB
	  Loaded: loaded (/etc/systemd/system/a-b.mount; static)
	  Active: active (mounted) since Thu, 30 Aug 2012 13:12:02 -0700; 4s ago
	   Where: /a/b
	    What: tmpfs
	 Process: 4044 ExecMount=/bin/mount tmpfs /a/b -t tmpfs (code=exited, status=0/SUCCESS)
	  CGroup: name=systemd:/system/a-b.mount

$
Comment 1 Lennart Poettering 2014-06-25 09:41:12 UTC
I am pretty sure this has been fixed by now. if you can reproduce this issue with current versions, please reopen!

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.