Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 May 2016 01:25:14 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r300255 - stable/9/sys/fs/nfsserver
Message-ID:  <201605200125.u4K1PEn2088920@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Fri May 20 01:25:14 2016
New Revision: 300255
URL: https://svnweb.freebsd.org/changeset/base/300255

Log:
  MFC: r299201
  Give mountd -S priority over outstanding RPC requests when suspending the nfsd.
  
  It was reported via email that under certain heavy RPC loads
  long delays before the exports would be updated was observed
  when using "mountd -S". This patch reverses the priority between
  the exclusive lock request to suspend the nfsd threads and the
  shared lock request for performing RPCs.
  As such, when mountd attempts to suspend the nfsd threads, it
  gets priority over outstanding RPC requests to do this.
  I suspect that the case reported was an artificial test load,
  but this patch did fix the problem for the reporter.

Modified:
  stable/9/sys/fs/nfsserver/nfs_nfsdkrpc.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/fs/   (props changed)

Modified: stable/9/sys/fs/nfsserver/nfs_nfsdkrpc.c
==============================================================================
--- stable/9/sys/fs/nfsserver/nfs_nfsdkrpc.c	Fri May 20 01:19:30 2016	(r300254)
+++ stable/9/sys/fs/nfsserver/nfs_nfsdkrpc.c	Fri May 20 01:25:14 2016	(r300255)
@@ -234,10 +234,16 @@ nfssvc_program(struct svc_req *rqst, SVC
 		 * Get a refcnt (shared lock) on nfsd_suspend_lock.
 		 * NFSSVC_SUSPENDNFSD will take an exclusive lock on
 		 * nfsd_suspend_lock to suspend these threads.
+		 * The call to nfsv4_lock() that preceeds nfsv4_getref()
+		 * ensures that the acquisition of the exclusive lock
+		 * takes priority over acquisition of the shared lock by
+		 * waiting for any exclusive lock request to complete.
 		 * This must be done here, before the check of
 		 * nfsv4root exports by nfsvno_v4rootexport().
 		 */
 		NFSLOCKV4ROOTMUTEX();
+		nfsv4_lock(&nfsd_suspend_lock, 0, NULL, NFSV4ROOTLOCKMUTEXPTR,
+		    NULL);
 		nfsv4_getref(&nfsd_suspend_lock, NULL, NFSV4ROOTLOCKMUTEXPTR,
 		    NULL);
 		NFSUNLOCKV4ROOTMUTEX();



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605200125.u4K1PEn2088920>