linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] some systemd unit changes
@ 2015-03-03 17:28 Martin Pitt
  2015-03-03 17:28 ` [PATCH 1/2] systemd: Order NFS server before client Martin Pitt
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Martin Pitt @ 2015-03-03 17:28 UTC (permalink / raw)
  To: linux-nfs; +Cc: systemd-devel

Hello NFS developers,

reposting the two patches inline as requested by Steve.

I'm currently systemd-ifying our nfs-utils Ubuntu package. For testing I put
the NFS server and client (i. e. localhost:/foo/bar mounts) on the same
machine. With that I get long hangs during shutdown on stopping the NFS .mount
units, as when that happens the NFS server is already shut down.

This is certainly a corner case as you'd usually not NFS-mount a share from
localhost; but fixing it is relatively simple with the first patch, which makes
sure that if NFS server and client are installed, the server starts before the
client, and the client stops before the server.

For a client without installed server this is harmless as Before= does not
imply a dependency. Likewise, for an NFS server which does not mount shares by
itself, it's also a no-op as remote-fs.target is empty. This would only
slightly reorder the boot sequence for machines which both are an NFS server
and have some remote NFS mounts, but I don't see an issue with that.

The second patch make NFS start earlier in the boot (i. e. before
basic.target), so that you can do things like put /var/ on NFS, or have rcS
SysV init scripts which depend on $remote_fs work. I tested this on both a
server and a client. This is certainly a bit more intrusive, but could be
worthwhile; what do you think?

Thanks for considering,

Martin


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] systemd: Order NFS server before client
  2015-03-03 17:28 [PATCH 0/2] some systemd unit changes Martin Pitt
@ 2015-03-03 17:28 ` Martin Pitt
  2015-03-03 17:58   ` [systemd-devel] " Zbigniew Jędrzejewski-Szmek
  2015-03-03 17:28 ` [PATCH 2/2] systemd: Relax dependencies of services Martin Pitt
  2015-03-19 18:20 ` [systemd-devel] [PATCH 0/2] some systemd unit changes Steve Dickson
  2 siblings, 1 reply; 8+ messages in thread
From: Martin Pitt @ 2015-03-03 17:28 UTC (permalink / raw)
  To: linux-nfs; +Cc: systemd-devel, Martin Pitt

This makes mounting NFS shares from localhost work reliably, as you need to
start the server before attempting (client) mounts, and conversely on shutdown
need to unmount all shares before stopping the server to avoid hangs.
---
 systemd/nfs-server.service | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/systemd/nfs-server.service b/systemd/nfs-server.service
index 8010aad..b35e193 100644
--- a/systemd/nfs-server.service
+++ b/systemd/nfs-server.service
@@ -13,6 +13,9 @@ Before= rpc-statd-notify.service
 Wants=auth-rpcgss-module.service
 After=rpc-gssd.service gssproxy.service rpc-svcgssd.service
 
+# start/stop server before/after client
+Before=remote-fs-pre.target
+
 Wants=nfs-config.service
 After=nfs-config.service
 
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] systemd: Relax dependencies of services
  2015-03-03 17:28 [PATCH 0/2] some systemd unit changes Martin Pitt
  2015-03-03 17:28 ` [PATCH 1/2] systemd: Order NFS server before client Martin Pitt
@ 2015-03-03 17:28 ` Martin Pitt
  2015-03-03 18:08   ` [systemd-devel] " Zbigniew Jędrzejewski-Szmek
  2015-03-19 18:20 ` [systemd-devel] [PATCH 0/2] some systemd unit changes Steve Dickson
  2 siblings, 1 reply; 8+ messages in thread
From: Martin Pitt @ 2015-03-03 17:28 UTC (permalink / raw)
  To: linux-nfs; +Cc: systemd-devel, Martin Pitt

Stop depending on basic.target in the daemons which still do; i. e. add
DefaultDependencies=no. This makes it possible to run NFS during early boot,
and helps if you e. g. have /var on NFS. We don't require much else than
local-fs.
---
 systemd/auth-rpcgss-module.service | 1 +
 systemd/nfs-config.service         | 2 ++
 systemd/nfs-idmapd.service         | 3 ++-
 systemd/nfs-mountd.service         | 3 ++-
 systemd/nfs-server.service         | 2 ++
 systemd/rpc-statd-notify.service   | 3 ++-
 systemd/rpc-svcgssd.service        | 3 ++-
 7 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/systemd/auth-rpcgss-module.service b/systemd/auth-rpcgss-module.service
index 0355e13..5241f7b 100644
--- a/systemd/auth-rpcgss-module.service
+++ b/systemd/auth-rpcgss-module.service
@@ -6,6 +6,7 @@
 # unit will fail.  But that's OK.)
 [Unit]
 Description=Kernel Module supporting RPCSEC_GSS
+DefaultDependencies=no
 Before=gssproxy.service rpc-svcgssd.service rpc-gssd.service
 Wants=gssproxy.service rpc-svcgssd.service rpc-gssd.service
 ConditionPathExists=/etc/krb5.keytab
diff --git a/systemd/nfs-config.service b/systemd/nfs-config.service
index 64010e6..7f65305 100644
--- a/systemd/nfs-config.service
+++ b/systemd/nfs-config.service
@@ -1,5 +1,7 @@
 [Unit]
 Description=Preprocess NFS configuration
+After=local-fs.target
+DefaultDependencies=no
 
 [Service]
 Type=oneshot
diff --git a/systemd/nfs-idmapd.service b/systemd/nfs-idmapd.service
index e84f8c8..df3dd9d 100644
--- a/systemd/nfs-idmapd.service
+++ b/systemd/nfs-idmapd.service
@@ -1,7 +1,8 @@
 [Unit]
 Description=NFSv4 ID-name mapping service
+DefaultDependencies=no
 Requires=var-lib-nfs-rpc_pipefs.mount
-After=var-lib-nfs-rpc_pipefs.mount
+After=var-lib-nfs-rpc_pipefs.mount local-fs.target
 
 BindsTo=nfs-server.service
 
diff --git a/systemd/nfs-mountd.service b/systemd/nfs-mountd.service
index d908afe..8a39f3e 100644
--- a/systemd/nfs-mountd.service
+++ b/systemd/nfs-mountd.service
@@ -1,8 +1,9 @@
 [Unit]
 Description=NFS Mount Daemon
+DefaultDependencies=no
 Requires=proc-fs-nfsd.mount
 After=proc-fs-nfsd.mount
-After=network.target
+After=network.target local-fs.target
 BindsTo=nfs-server.service
 
 Wants=nfs-config.service
diff --git a/systemd/nfs-server.service b/systemd/nfs-server.service
index b35e193..db801cb 100644
--- a/systemd/nfs-server.service
+++ b/systemd/nfs-server.service
@@ -1,10 +1,12 @@
 [Unit]
 Description=NFS server and services
+DefaultDependencies=no
 Requires= network.target proc-fs-nfsd.mount rpcbind.target
 Requires= nfs-mountd.service
 Wants=rpc-statd.service nfs-idmapd.service
 Wants=rpc-statd-notify.service
 
+After= local-fs.target
 After= network.target proc-fs-nfsd.mount rpcbind.target nfs-mountd.service
 After= nfs-idmapd.service rpc-statd.service
 Before= rpc-statd-notify.service
diff --git a/systemd/rpc-statd-notify.service b/systemd/rpc-statd-notify.service
index a655445..a7e2f8e 100644
--- a/systemd/rpc-statd-notify.service
+++ b/systemd/rpc-statd-notify.service
@@ -1,7 +1,8 @@
 [Unit]
 Description=Notify NFS peers of a restart
+DefaultDependencies=no
 Requires=network-online.target
-After=network.target nss-lookup.target
+After=local-fs.target network.target nss-lookup.target
 
 # if we run an nfs server, it needs to be running before we
 # tell clients that it has restarted.
diff --git a/systemd/rpc-svcgssd.service b/systemd/rpc-svcgssd.service
index f7424b0..41177b6 100644
--- a/systemd/rpc-svcgssd.service
+++ b/systemd/rpc-svcgssd.service
@@ -1,7 +1,8 @@
 [Unit]
 Description=RPC security service for NFS server
+DefaultDependencies=no
 Requires=var-lib-nfs-rpc_pipefs.mount
-After=var-lib-nfs-rpc_pipefs.mount
+After=var-lib-nfs-rpc_pipefs.mount local-fs.target
 PartOf=nfs-server.service
 PartOf=nfs-utils.service
 
-- 
2.1.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [systemd-devel] [PATCH 1/2] systemd: Order NFS server before client
  2015-03-03 17:28 ` [PATCH 1/2] systemd: Order NFS server before client Martin Pitt
@ 2015-03-03 17:58   ` Zbigniew Jędrzejewski-Szmek
  0 siblings, 0 replies; 8+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2015-03-03 17:58 UTC (permalink / raw)
  To: Martin Pitt; +Cc: linux-nfs, systemd-devel

On Tue, Mar 03, 2015 at 06:28:09PM +0100, Martin Pitt wrote:
> This makes mounting NFS shares from localhost work reliably, as you need to
> start the server before attempting (client) mounts, and conversely on shutdown
> need to unmount all shares before stopping the server to avoid hangs.
> ---
>  systemd/nfs-server.service | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/systemd/nfs-server.service b/systemd/nfs-server.service
> index 8010aad..b35e193 100644
> --- a/systemd/nfs-server.service
> +++ b/systemd/nfs-server.service
> @@ -13,6 +13,9 @@ Before= rpc-statd-notify.service
>  Wants=auth-rpcgss-module.service
>  After=rpc-gssd.service gssproxy.service rpc-svcgssd.service
>  
> +# start/stop server before/after client
> +Before=remote-fs-pre.target
> +
>  Wants=nfs-config.service
>  After=nfs-config.service

Looks reasonable.

Zbyszek

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [systemd-devel] [PATCH 2/2] systemd: Relax dependencies of services
  2015-03-03 17:28 ` [PATCH 2/2] systemd: Relax dependencies of services Martin Pitt
@ 2015-03-03 18:08   ` Zbigniew Jędrzejewski-Szmek
  2015-03-03 20:12     ` Martin Pitt
  0 siblings, 1 reply; 8+ messages in thread
From: Zbigniew Jędrzejewski-Szmek @ 2015-03-03 18:08 UTC (permalink / raw)
  To: Martin Pitt; +Cc: linux-nfs, systemd-devel

On Tue, Mar 03, 2015 at 06:28:10PM +0100, Martin Pitt wrote:
> Stop depending on basic.target in the daemons which still do; i. e. add
> DefaultDependencies=no. This makes it possible to run NFS during early boot,
> and helps if you e. g. have /var on NFS. We don't require much else than
> local-fs.
Are you sure that all of those nfs daemons do not require
sockets.target and other stuff provided by basic.target to be ready?

Zbyszek

> ---
>  systemd/auth-rpcgss-module.service | 1 +
>  systemd/nfs-config.service         | 2 ++
>  systemd/nfs-idmapd.service         | 3 ++-
>  systemd/nfs-mountd.service         | 3 ++-
>  systemd/nfs-server.service         | 2 ++
>  systemd/rpc-statd-notify.service   | 3 ++-
>  systemd/rpc-svcgssd.service        | 3 ++-
>  7 files changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/systemd/auth-rpcgss-module.service b/systemd/auth-rpcgss-module.service
> index 0355e13..5241f7b 100644
> --- a/systemd/auth-rpcgss-module.service
> +++ b/systemd/auth-rpcgss-module.service
> @@ -6,6 +6,7 @@
>  # unit will fail.  But that's OK.)
>  [Unit]
>  Description=Kernel Module supporting RPCSEC_GSS
> +DefaultDependencies=no
>  Before=gssproxy.service rpc-svcgssd.service rpc-gssd.service
>  Wants=gssproxy.service rpc-svcgssd.service rpc-gssd.service
>  ConditionPathExists=/etc/krb5.keytab
> diff --git a/systemd/nfs-config.service b/systemd/nfs-config.service
> index 64010e6..7f65305 100644
> --- a/systemd/nfs-config.service
> +++ b/systemd/nfs-config.service
> @@ -1,5 +1,7 @@
>  [Unit]
>  Description=Preprocess NFS configuration
> +After=local-fs.target
> +DefaultDependencies=no
>  
>  [Service]
>  Type=oneshot
> diff --git a/systemd/nfs-idmapd.service b/systemd/nfs-idmapd.service
> index e84f8c8..df3dd9d 100644
> --- a/systemd/nfs-idmapd.service
> +++ b/systemd/nfs-idmapd.service
> @@ -1,7 +1,8 @@
>  [Unit]
>  Description=NFSv4 ID-name mapping service
> +DefaultDependencies=no
>  Requires=var-lib-nfs-rpc_pipefs.mount
> -After=var-lib-nfs-rpc_pipefs.mount
> +After=var-lib-nfs-rpc_pipefs.mount local-fs.target
>  
>  BindsTo=nfs-server.service
>  
> diff --git a/systemd/nfs-mountd.service b/systemd/nfs-mountd.service
> index d908afe..8a39f3e 100644
> --- a/systemd/nfs-mountd.service
> +++ b/systemd/nfs-mountd.service
> @@ -1,8 +1,9 @@
>  [Unit]
>  Description=NFS Mount Daemon
> +DefaultDependencies=no
>  Requires=proc-fs-nfsd.mount
>  After=proc-fs-nfsd.mount
> -After=network.target
> +After=network.target local-fs.target
>  BindsTo=nfs-server.service
>  
>  Wants=nfs-config.service
> diff --git a/systemd/nfs-server.service b/systemd/nfs-server.service
> index b35e193..db801cb 100644
> --- a/systemd/nfs-server.service
> +++ b/systemd/nfs-server.service
> @@ -1,10 +1,12 @@
>  [Unit]
>  Description=NFS server and services
> +DefaultDependencies=no
>  Requires= network.target proc-fs-nfsd.mount rpcbind.target
>  Requires= nfs-mountd.service
>  Wants=rpc-statd.service nfs-idmapd.service
>  Wants=rpc-statd-notify.service
>  
> +After= local-fs.target
>  After= network.target proc-fs-nfsd.mount rpcbind.target nfs-mountd.service
>  After= nfs-idmapd.service rpc-statd.service
>  Before= rpc-statd-notify.service
> diff --git a/systemd/rpc-statd-notify.service b/systemd/rpc-statd-notify.service
> index a655445..a7e2f8e 100644
> --- a/systemd/rpc-statd-notify.service
> +++ b/systemd/rpc-statd-notify.service
> @@ -1,7 +1,8 @@
>  [Unit]
>  Description=Notify NFS peers of a restart
> +DefaultDependencies=no
>  Requires=network-online.target
> -After=network.target nss-lookup.target
> +After=local-fs.target network.target nss-lookup.target
>  
>  # if we run an nfs server, it needs to be running before we
>  # tell clients that it has restarted.
> diff --git a/systemd/rpc-svcgssd.service b/systemd/rpc-svcgssd.service
> index f7424b0..41177b6 100644
> --- a/systemd/rpc-svcgssd.service
> +++ b/systemd/rpc-svcgssd.service
> @@ -1,7 +1,8 @@
>  [Unit]
>  Description=RPC security service for NFS server
> +DefaultDependencies=no
>  Requires=var-lib-nfs-rpc_pipefs.mount
> -After=var-lib-nfs-rpc_pipefs.mount
> +After=var-lib-nfs-rpc_pipefs.mount local-fs.target
>  PartOf=nfs-server.service
>  PartOf=nfs-utils.service
>  
> -- 
> 2.1.4
> 
> _______________________________________________
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [systemd-devel] [PATCH 2/2] systemd: Relax dependencies of services
  2015-03-03 18:08   ` [systemd-devel] " Zbigniew Jędrzejewski-Szmek
@ 2015-03-03 20:12     ` Martin Pitt
  2015-03-03 21:44       ` Steve Dickson
  0 siblings, 1 reply; 8+ messages in thread
From: Martin Pitt @ 2015-03-03 20:12 UTC (permalink / raw)
  To: linux-nfs; +Cc: systemd-devel

Hello all,

Zbigniew Jędrzejewski-Szmek [2015-03-03 19:08 +0100]:
> Are you sure that all of those nfs daemons do not require
> sockets.target and other stuff provided by basic.target to be ready?

The corresponding upstart jobs trigger on virtual file systems (/sys,
etc.) and rpcbind, and we've used them for years. Also, NFS does not
yet use socket activation, or talks to other services on sockets
(except for rpcbind), so we don't need sockets.target either.  The
other dependencies (some network.target, some nss-lookup.target, etc.)
are already specified explicitly. So I'm quite sure.

That said, there's of course always a nonzero chance that this breaks
in a case which I haven't tested. In particular, I didn't test
kerberos/gssd, I'd appreciate if someone who has a real-world setup
with that could give this a spin.

Thanks,

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [systemd-devel] [PATCH 2/2] systemd: Relax dependencies of services
  2015-03-03 20:12     ` Martin Pitt
@ 2015-03-03 21:44       ` Steve Dickson
  0 siblings, 0 replies; 8+ messages in thread
From: Steve Dickson @ 2015-03-03 21:44 UTC (permalink / raw)
  To: linux-nfs, systemd-devel



On 03/03/2015 03:12 PM, Martin Pitt wrote:
> Hello all,
> 
> Zbigniew Jędrzejewski-Szmek [2015-03-03 19:08 +0100]:
>> Are you sure that all of those nfs daemons do not require
>> sockets.target and other stuff provided by basic.target to be ready?
> 
> The corresponding upstart jobs trigger on virtual file systems (/sys,
> etc.) and rpcbind, and we've used them for years. Also, NFS does not
> yet use socket activation, or talks to other services on sockets
> (except for rpcbind), so we don't need sockets.target either.  The
> other dependencies (some network.target, some nss-lookup.target, etc.)
> are already specified explicitly. So I'm quite sure.
You are correct. rpcbind is the only service we have that uses socket
activation, which I don't think works very well... 

Just last week I notice if you reboot a vm and the first command 
you type is rpcinfo -p. That command will time out trying to talk
with rpcbind. After the timeout everything works fine... 

I thought I opened a bz but I can't seem to find it.

steved.

> 
> That said, there's of course always a nonzero chance that this breaks
> in a case which I haven't tested. In particular, I didn't test
> kerberos/gssd, I'd appreciate if someone who has a real-world setup
> with that could give this a spin.
> 
> Thanks,
> 
> Martin
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [systemd-devel] [PATCH 0/2] some systemd unit changes
  2015-03-03 17:28 [PATCH 0/2] some systemd unit changes Martin Pitt
  2015-03-03 17:28 ` [PATCH 1/2] systemd: Order NFS server before client Martin Pitt
  2015-03-03 17:28 ` [PATCH 2/2] systemd: Relax dependencies of services Martin Pitt
@ 2015-03-19 18:20 ` Steve Dickson
  2 siblings, 0 replies; 8+ messages in thread
From: Steve Dickson @ 2015-03-19 18:20 UTC (permalink / raw)
  To: Martin Pitt, linux-nfs; +Cc: systemd-devel



On 03/03/2015 12:28 PM, Martin Pitt wrote:
> Hello NFS developers,
> 
> reposting the two patches inline as requested by Steve.
> 
> I'm currently systemd-ifying our nfs-utils Ubuntu package. For testing I put
> the NFS server and client (i. e. localhost:/foo/bar mounts) on the same
> machine. With that I get long hangs during shutdown on stopping the NFS .mount
> units, as when that happens the NFS server is already shut down.
> 
> This is certainly a corner case as you'd usually not NFS-mount a share from
> localhost; but fixing it is relatively simple with the first patch, which makes
> sure that if NFS server and client are installed, the server starts before the
> client, and the client stops before the server.
> 
> For a client without installed server this is harmless as Before= does not
> imply a dependency. Likewise, for an NFS server which does not mount shares by
> itself, it's also a no-op as remote-fs.target is empty. This would only
> slightly reorder the boot sequence for machines which both are an NFS server
> and have some remote NFS mounts, but I don't see an issue with that.
> 
> The second patch make NFS start earlier in the boot (i. e. before
> basic.target), so that you can do things like put /var/ on NFS, or have rcS
> SysV init scripts which depend on $remote_fs work. I tested this on both a
> server and a client. This is certainly a bit more intrusive, but could be
> worthwhile; what do you think?
> 
> Thanks for considering,
Committed....

steved.

> 
> Martin
> 
> _______________________________________________
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/systemd-devel
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-03-19 18:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-03 17:28 [PATCH 0/2] some systemd unit changes Martin Pitt
2015-03-03 17:28 ` [PATCH 1/2] systemd: Order NFS server before client Martin Pitt
2015-03-03 17:58   ` [systemd-devel] " Zbigniew Jędrzejewski-Szmek
2015-03-03 17:28 ` [PATCH 2/2] systemd: Relax dependencies of services Martin Pitt
2015-03-03 18:08   ` [systemd-devel] " Zbigniew Jędrzejewski-Szmek
2015-03-03 20:12     ` Martin Pitt
2015-03-03 21:44       ` Steve Dickson
2015-03-19 18:20 ` [systemd-devel] [PATCH 0/2] some systemd unit changes Steve Dickson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).