Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Sep 2010 01:18:03 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r212834 - head/sys/fs/nfsserver
Message-ID:  <201009190118.o8J1I3wD084310@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Sun Sep 19 01:18:03 2010
New Revision: 212834
URL: http://svn.freebsd.org/changeset/base/212834

Log:
  Fix nfsrv_freeallnfslocks() in the experimental NFSv4 server so that
  it frees local locks correctly upon close. In order for
  nfsrv_localunlock() to work correctly, the lock can no longer be in
  the lockowner's stateid list. As such, nfsrv_freenfslock() has to
  be called before nfsrv_localunlock(), to get rid of the lock structure
  on the lockowner's stateid list. This only affected operation when
  local locks (vfs.newnfs.enable_locallocks=1) are enabled, which is
  not the default at this time.
  
  MFC after:	1 week

Modified:
  head/sys/fs/nfsserver/nfs_nfsdstate.c

Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c
==============================================================================
--- head/sys/fs/nfsserver/nfs_nfsdstate.c	Sun Sep 19 01:05:19 2010	(r212833)
+++ head/sys/fs/nfsserver/nfs_nfsdstate.c	Sun Sep 19 01:18:03 2010	(r212834)
@@ -1137,6 +1137,7 @@ nfsrv_freeallnfslocks(struct nfsstate *s
 	struct nfslockfile *lfp = NULL;
 	int gottvp = 0;
 	vnode_t tvp = NULL;
+	uint64_t first, end;
 
 	lop = LIST_FIRST(&stp->ls_lock);
 	while (lop != LIST_END(&stp->ls_lock)) {
@@ -1167,14 +1168,16 @@ nfsrv_freeallnfslocks(struct nfsstate *s
 		if (tvp != NULL) {
 			if (cansleep == 0)
 				panic("allnfs2");
-			nfsrv_localunlock(tvp, lfp, lop->lo_first,
-			    lop->lo_end, p);
+			first = lop->lo_first;
+			end = lop->lo_end;
+			nfsrv_freenfslock(lop);
+			nfsrv_localunlock(tvp, lfp, first, end, p);
 			LIST_FOREACH_SAFE(rlp, &lfp->lf_rollback, rlck_list,
 			    nrlp)
 				free(rlp, M_NFSDROLLBACK);
 			LIST_INIT(&lfp->lf_rollback);
-		}
-		nfsrv_freenfslock(lop);
+		} else
+			nfsrv_freenfslock(lop);
 		lop = nlop;
 	}
 	if (vp == NULL && tvp != NULL)



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