Fix nfs-mountd dependency on rpcbind
diff mbox

Message ID 20170207191650.19219-1-rafael.tinoco@canonical.com
State New
Headers show

Commit Message

Rafael Tinoco Feb. 7, 2017, 7:16 p.m. UTC
Following commit 91da135f - it replaced "rpcbind.target" by "rpcbind.socket" in
some unit files - "rpcbind.socket" should also be added to "nfs-mountd.service"
as a dependency to avoid race conditions.

Usually "rpcbind.socket" is either started as a "sockets.target" dependency, or
as a dependency for "nfs-server.service", when unit files include it in
"BindsTo" or "After". Unfortunately there is a possilibility to have
"nfs-mountd.service" started when the rpcbind socket is not yet created:

systemd[1]: Starting NFS Mount Daemon...
systemd[1]: nfs-mountd.service: Control process exited, code=exited status=1
systemd[1]: Failed to start NFS Mount Daemon.
systemd[1]: nfs-mountd.service: Unit entered failed state.
systemd[1]: nfs-mountd.service: Failed with result 'exit-code'.

Nowadays "nfs-mountd.service" uses "BindTo" directive to "nfs-server.service".
That, per se, doesn't guarantee ordering for NFS server to start rpcbind and for
nfs-mountd to depend on it.

https://bugs.launchpad.net/bugs/1590799

Signed-off-by: Rafael David Tinoco <rafael.tinoco@canonical.com>
---
 systemd/nfs-mountd.service | 1 +
 1 file changed, 1 insertion(+)

Comments

NeilBrown Feb. 7, 2017, 11:03 p.m. UTC | #1
On Tue, Feb 07 2017, Rafael David Tinoco wrote:

> Following commit 91da135f - it replaced "rpcbind.target" by "rpcbind.socket" in
> some unit files - "rpcbind.socket" should also be added to "nfs-mountd.service"
> as a dependency to avoid race conditions.
>
> Usually "rpcbind.socket" is either started as a "sockets.target" dependency, or
> as a dependency for "nfs-server.service", when unit files include it in
> "BindsTo" or "After". Unfortunately there is a possilibility to have
> "nfs-mountd.service" started when the rpcbind socket is not yet created:
>
> systemd[1]: Starting NFS Mount Daemon...
> systemd[1]: nfs-mountd.service: Control process exited, code=exited status=1
> systemd[1]: Failed to start NFS Mount Daemon.
> systemd[1]: nfs-mountd.service: Unit entered failed state.
> systemd[1]: nfs-mountd.service: Failed with result 'exit-code'.
>
> Nowadays "nfs-mountd.service" uses "BindTo" directive to "nfs-server.service".
> That, per se, doesn't guarantee ordering for NFS server to start rpcbind and for
> nfs-mountd to depend on it.
>
> https://bugs.launchpad.net/bugs/1590799
>
> Signed-off-by: Rafael David Tinoco <rafael.tinoco@canonical.com>

Thanks for finding this!

 Reviewed-by: NeilBrown <neilb@suse.com>

I would not be against adding
  Wants=rpcbind.socket

but as you say, it isn't strictly needed.

Thanks,
NeilBrown


> ---
>  systemd/nfs-mountd.service | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/systemd/nfs-mountd.service b/systemd/nfs-mountd.service
> index 15e828b..b0a8bc0 100644
> --- a/systemd/nfs-mountd.service
> +++ b/systemd/nfs-mountd.service
> @@ -4,6 +4,7 @@ DefaultDependencies=no
>  Requires=proc-fs-nfsd.mount
>  After=proc-fs-nfsd.mount
>  After=network.target local-fs.target
> +After=rpcbind.socket
>  BindsTo=nfs-server.service
>  
>  [Service]
> -- 
> 2.9.3
Steve Dickson Feb. 16, 2017, 10:22 a.m. UTC | #2
On 02/07/2017 02:16 PM, Rafael David Tinoco wrote:
> Following commit 91da135f - it replaced "rpcbind.target" by "rpcbind.socket" in
> some unit files - "rpcbind.socket" should also be added to "nfs-mountd.service"
> as a dependency to avoid race conditions.
>
> Usually "rpcbind.socket" is either started as a "sockets.target" dependency, or
> as a dependency for "nfs-server.service", when unit files include it in
> "BindsTo" or "After". Unfortunately there is a possilibility to have
> "nfs-mountd.service" started when the rpcbind socket is not yet created:
>
> systemd[1]: Starting NFS Mount Daemon...
> systemd[1]: nfs-mountd.service: Control process exited, code=exited status=1
> systemd[1]: Failed to start NFS Mount Daemon.
> systemd[1]: nfs-mountd.service: Unit entered failed state.
> systemd[1]: nfs-mountd.service: Failed with result 'exit-code'.
>
> Nowadays "nfs-mountd.service" uses "BindTo" directive to "nfs-server.service".
> That, per se, doesn't guarantee ordering for NFS server to start rpcbind and for
> nfs-mountd to depend on it.
>
> https://bugs.launchpad.net/bugs/1590799
>
> Signed-off-by: Rafael David Tinoco <rafael.tinoco@canonical.com>
Committed

steved.
> ---
>  systemd/nfs-mountd.service | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/systemd/nfs-mountd.service b/systemd/nfs-mountd.service
> index 15e828b..b0a8bc0 100644
> --- a/systemd/nfs-mountd.service
> +++ b/systemd/nfs-mountd.service
> @@ -4,6 +4,7 @@ DefaultDependencies=no
>  Requires=proc-fs-nfsd.mount
>  After=proc-fs-nfsd.mount
>  After=network.target local-fs.target
> +After=rpcbind.socket
>  BindsTo=nfs-server.service
>  
>  [Service]

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/systemd/nfs-mountd.service b/systemd/nfs-mountd.service
index 15e828b..b0a8bc0 100644
--- a/systemd/nfs-mountd.service
+++ b/systemd/nfs-mountd.service
@@ -4,6 +4,7 @@  DefaultDependencies=no
 Requires=proc-fs-nfsd.mount
 After=proc-fs-nfsd.mount
 After=network.target local-fs.target
+After=rpcbind.socket
 BindsTo=nfs-server.service
 
 [Service]