From owner-svn-src-head@FreeBSD.ORG Fri Dec 17 22:18:10 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7792C106566B; Fri, 17 Dec 2010 22:18:10 +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 4B6058FC13; Fri, 17 Dec 2010 22:18:10 +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 oBHMIAM7018287; Fri, 17 Dec 2010 22:18:10 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oBHMIApH018285; Fri, 17 Dec 2010 22:18:10 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201012172218.oBHMIApH018285@svn.freebsd.org> From: Rick Macklem Date: Fri, 17 Dec 2010 22:18:10 +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: r216510 - head/sys/fs/nfsserver X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Dec 2010 22:18:10 -0000 Author: rmacklem Date: Fri Dec 17 22:18:09 2010 New Revision: 216510 URL: http://svn.freebsd.org/changeset/base/216510 Log: Fix two vnode locking problems in nfsd_recalldelegation() in the experimental NFSv4 server. The first was a bogus use of VOP_ISLOCKED() in a KASSERT() and the second was the need to lock the vnode for the nfsrv_checkremove() call. Also, delete a "__unused" that was bogus, since the argument is used. Reviewed by: zack.kirsch at isilon.com 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 Fri Dec 17 22:09:55 2010 (r216509) +++ head/sys/fs/nfsserver/nfs_nfsdstate.c Fri Dec 17 22:18:09 2010 (r216510) @@ -4275,7 +4275,7 @@ nfsrv_clientconflict(struct nfsclient *c */ static int nfsrv_delegconflict(struct nfsstate *stp, int *haslockp, NFSPROC_T *p, - __unused vnode_t vp) + vnode_t vp) { struct nfsclient *clp = stp->ls_clp; int gotlock, error, retrycnt, zapped_clp; @@ -4568,8 +4568,6 @@ nfsd_recalldelegation(vnode_t vp, NFSPRO int32_t starttime; int error; - KASSERT(!VOP_ISLOCKED(vp), ("vp %p is locked", vp)); - /* * First, check to see if the server is currently running and it has * been called for a regular file when issuing delegations. @@ -4578,6 +4576,7 @@ nfsd_recalldelegation(vnode_t vp, NFSPRO nfsrv_issuedelegs == 0) return; + KASSERT((VOP_ISLOCKED(vp) != LK_EXCLUSIVE), ("vp %p is locked", vp)); /* * First, get a reference on the nfsv4rootfs_lock so that an * exclusive lock cannot be acquired by another thread. @@ -4593,7 +4592,12 @@ nfsd_recalldelegation(vnode_t vp, NFSPRO NFSGETNANOTIME(&mytime); starttime = (u_int32_t)mytime.tv_sec; do { - error = nfsrv_checkremove(vp, 0, p); + vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); + if ((vp->v_iflag & VI_DOOMED) == 0) + error = nfsrv_checkremove(vp, 0, p); + else + error = EPERM; + VOP_UNLOCK(vp, 0); if (error == NFSERR_DELAY) { NFSGETNANOTIME(&mytime); if (((u_int32_t)mytime.tv_sec - starttime) >