From 9ac60a3aa3771e8d6612bbce261d8c7045f26566 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 7 Jul 2010 12:11:29 +0000 Subject: [PATCH] =?UTF-8?q?*=20Merge=20the=20=E2=80=98nfs-kernel-sm-notify?= =?UTF-8?q?=E2=80=99=20task=20into=20the=20post-start=20script=20of=20=20?= =?UTF-8?q?=20the=20=E2=80=98nfs-kernel-statd=E2=80=99=20task.=20*=20Work?= =?UTF-8?q?=20around=20an=20apparent=20bug=20in=20Upstart:=20the=20?= =?UTF-8?q?=E2=80=98mountall=E2=80=99=20task=20cannot=20=20=20be=20restart?= =?UTF-8?q?ed=20because=20of=20the=20=E2=80=98starting=20mountall=E2=80=99?= =?UTF-8?q?=20condition=20in=20the=20=20=20statd=20task.=20=20So=20instead?= =?UTF-8?q?=20make=20=E2=80=98mountall=E2=80=99=20depend=20on=20=E2=80=98s?= =?UTF-8?q?tarted=20=20=20nfs-kernel-statd=E2=80=99.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit svn path=/nixos/trunk/; revision=22508 --- .../network-filesystems/nfs-kernel.nix | 18 +++--------------- modules/tasks/filesystems.nix | 8 +++++++- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/modules/services/network-filesystems/nfs-kernel.nix b/modules/services/network-filesystems/nfs-kernel.nix index e9c42237e0d..de41015c82d 100644 --- a/modules/services/network-filesystems/nfs-kernel.nix +++ b/modules/services/network-filesystems/nfs-kernel.nix @@ -161,7 +161,7 @@ in description = "Kernel NFS server - Network Status Monitor"; - startOn = "${if cfg.server.enable then "starting nfs-kernel-nfsd and " else ""} started portmap"; + startOn = "started portmap" + optionalString cfg.server.enable " and starting nfs-kernel-nfsd"; stopOn = "never"; preStart = @@ -174,21 +174,9 @@ in daemonType = "fork"; exec = "${pkgs.nfsUtils}/sbin/rpc.statd --no-notify"; - }; - } - - // optionalAttrs (cfg.client.enable || cfg.server.enable) - { nfs_kernel_sm_notify = - { name = "nfs-kernel-sm-notify"; - description = "Kernel NFS server - Reboot notification"; - - startOn = "started nfs-kernel-statd" - + (if cfg.client.enable then " and starting mountall" else ""); - - task = true; - - exec = "${pkgs.nfsUtils}/sbin/sm-notify -d"; + postStart = optionalString cfg.client.enable + "${pkgs.nfsUtils}/sbin/sm-notify -d"; }; }; diff --git a/modules/tasks/filesystems.nix b/modules/tasks/filesystems.nix index 7d53824d050..22df9dd2a32 100644 --- a/modules/tasks/filesystems.nix +++ b/modules/tasks/filesystems.nix @@ -155,7 +155,13 @@ in }; jobs.mountall = - { startOn = "started udev"; + { startOn = "started udev" + # !!! The `started nfs-kernel-statd' condition shouldn't be + # here. The `nfs-kernel-statd' job should have a `starting + # mountall' condition. However, that doesn't work if + # `mountall' is restarted due to an apparent bug in Upstart: + # `mountall' hangs forever in the `start/starting' state. + + optionalString config.services.nfsKernel.client.enable " and started nfs-kernel-statd"; task = true;