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;