All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Pitt <martin.pitt@ubuntu.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH] systemd: Order NFS server before client
Date: Tue, 3 Mar 2015 10:55:16 +0100	[thread overview]
Message-ID: <20150303095516.GB3219@piware.de> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1158 bytes --]

Hello all,

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 attached
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.

Thanks for considering,

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

[-- Attachment #1.2: 0001-systemd-Order-NFS-server-before-client.patch --]
[-- Type: text/x-diff, Size: 987 bytes --]

From d8c1fcce6d06aa062315a47134e8e3b364cb0700 Mon Sep 17 00:00:00 2001
From: Martin Pitt <martin.pitt@ubuntu.com>
Date: Tue, 3 Mar 2015 10:45:38 +0100
Subject: [PATCH] systemd: Order NFS server before client

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


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

                 reply	other threads:[~2015-03-03 10:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150303095516.GB3219@piware.de \
    --to=martin.pitt@ubuntu.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.