Bug 1046297

Summary: bg (background) NFS mounts doesn't work as expected
Product: [Fedora] Fedora Reporter: Tore Anderson <tore>
Component: systemdAssignee: systemd-maint
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: johannbg, lnykryn, msekleta, plautrba, systemd-maint, vpavlin, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-20 00:17:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Tore Anderson 2013-12-24 11:42:49 UTC
Description of problem:

A NFS mount declared as "bg" in /etc/fstab doesn't work as expected. It ends up blocking the bootup process.

Version-Release number of selected component (if applicable):

systemd-208-9.fc20.x86_64

How reproducible:

100%

Steps to Reproduce:
1. Add a NFS mount of an unreachable NFS server in /etc/fstab, using "defaults,bg" as the mount options
2. Reboot

Actual results:

The reboot stalls at the mount job, waiting for a timeout.

Expected results:

The mount process should be backgrounded and the boot process continue immediately.

Additional info:

nfs(5) describes the bg mount option:

                      If  the  bg  option  is  specified, a timeout or failure
                      causes the mount(8) command to fork a child  which  con‐
                      tinues to attempt to mount the export.  The parent imme‐
                      diately returns with a zero exit code.  This is known as
                      a "background" mount.

The fstab line that triggers the bug on my system is:

192.168.0.2:/fud                          /fud                    nfs     defaults,bg     0 0

tore@sloth:~$ systemctl status fud.mount
fud.mount - /fud
   Loaded: loaded (/etc/fstab)
   Active: failed (Result: timeout) since ti. 2013-12-24 12:35:17 CET; 21s ago
    Where: /fud
     What: 192.168.0.2:/fud
  Process: 1132 ExecMount=/bin/mount 192.168.0.2:/fud /fud -t nfs -o defaults,bg (code=killed, signal=TERM)

des. 24 12:16:06 sloth.fud.no systemd[1]: fud.mount mounting timed out. Stopping.
des. 24 12:16:06 sloth.fud.no systemd[1]: Mounted /fud.
des. 24 12:35:17 sloth.fud.no systemd[1]: Unit fud.mount entered failed state.

As you can see from the timestamps above, the start job stalled for 20 seconds. This stalled the entire bootup process, too.

Comment 1 Lennart Poettering 2014-06-20 00:17:40 UTC
Well, systemd watches the kernel for the mount to show up, and right-fully so as it shouldn't proceed with other mounts that are inside of this one before it actually was mouinted in the kernel. If you don't want to wait for the thing at boot, use "nofail".