From ef1755f3c0d4b82338ab71515692d91e8afc7fc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?= Date: Tue, 27 Dec 2011 18:08:05 +0000 Subject: [PATCH] I had a bug in my nfs server... just after boot, all clients were receiving "Permission denied" until I run "restart nfs-kernel-exports". "exportfs -ra" did not help. I tracked that down to some race condition between loading the module nfsd and starting the daemons. Therefore, I decided to add nfsd to the boot.kernelModules instead of using modprove with it. Now it works for my server. No more Permission denied after reboot. svn path=/nixos/trunk/; revision=31113 --- modules/services/network-filesystems/nfs-kernel.nix | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/services/network-filesystems/nfs-kernel.nix b/modules/services/network-filesystems/nfs-kernel.nix index 3e247271561..0cc9d07cad2 100644 --- a/modules/services/network-filesystems/nfs-kernel.nix +++ b/modules/services/network-filesystems/nfs-kernel.nix @@ -112,6 +112,14 @@ in target = "exports"; }); + /* We have to load this quite before running the daemons. Using + "modprobe nfsd" when loading the daemons causes a race condition where + nfsd can return 'authentication failed'/'Permission denied'. + + I've not tried with nfsd alone. So I add what I tried, with nfs_acl too. + */ + boot.kernelModules = mkIf cfg.server.enable [ "nfsd" "nfs_acl" ]; + jobs = optionalAttrs cfg.server.enable { nfs_kernel_exports = @@ -119,7 +127,7 @@ in description = "Kernel NFS server"; - startOn = "started network-interfaces and started portmap"; + startOn = "started network-interfaces and started portmap and filesystem"; postStart = '' @@ -147,9 +155,6 @@ in # Create a state directory required by NFSv4. mkdir -p /var/lib/nfs/v4recovery - # rpc.nfsd needs the kernel support - ${config.system.sbin.modprobe}/sbin/modprobe nfsd || true - ${pkgs.sysvtools}/bin/mountpoint -q /proc/fs/nfsd \ || ${config.system.sbin.mount}/bin/mount -t nfsd none /proc/fs/nfsd