From owner-svn-src-all@FreeBSD.ORG Sat Aug 28 23:50:09 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA7B8106564A; Sat, 28 Aug 2010 23:50:09 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AC6528FC14; Sat, 28 Aug 2010 23:50:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o7SNo94W046808; Sat, 28 Aug 2010 23:50:09 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o7SNo9H9046806; Sat, 28 Aug 2010 23:50:09 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201008282350.o7SNo9H9046806@svn.freebsd.org> From: Rick Macklem Date: Sat, 28 Aug 2010 23:50:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r211953 - head/sys/fs/nfsserver X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Aug 2010 23:50:09 -0000 Author: rmacklem Date: Sat Aug 28 23:50:09 2010 New Revision: 211953 URL: http://svn.freebsd.org/changeset/base/211953 Log: Add acquisition of a reference count on nfsv4root_lock to the nfsd_recalldelegation() function, since this function is called by nfsd threads when they are handling NFSv2 or NFSv3 RPCs, where no reference count would have been acquired. MFC after: 2 weeks Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c ============================================================================== --- head/sys/fs/nfsserver/nfs_nfsdstate.c Sat Aug 28 22:14:24 2010 (r211952) +++ head/sys/fs/nfsserver/nfs_nfsdstate.c Sat Aug 28 23:50:09 2010 (r211953) @@ -4563,6 +4563,14 @@ nfsd_recalldelegation(vnode_t vp, NFSPRO return; /* + * First, get a reference on the nfsv4rootfs_lock so that an + * exclusive lock cannot be acquired by another thread. + */ + NFSLOCKV4ROOTMUTEX(); + nfsv4_getref(&nfsv4rootfs_lock, NULL, NFSV4ROOTLOCKMUTEXPTR); + NFSUNLOCKV4ROOTMUTEX(); + + /* * Now, call nfsrv_checkremove() in a loop while it returns * NFSERR_DELAY. Return upon any other error or when timed out. */ @@ -4576,11 +4584,14 @@ nfsd_recalldelegation(vnode_t vp, NFSPRO NFS_REMOVETIMEO && ((u_int32_t)mytime.tv_sec - starttime) < 100000) - return; + break; /* Sleep for a short period of time */ (void) nfs_catnap(PZERO, 0, "nfsremove"); } } while (error == NFSERR_DELAY); + NFSLOCKV4ROOTMUTEX(); + nfsv4_relref(&nfsv4rootfs_lock); + NFSUNLOCKV4ROOTMUTEX(); } APPLESTATIC void