Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Jan 2012 01:58:49 +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-8@freebsd.org
Subject:   svn commit: r229955 - stable/8/sys/fs/nfsclient
Message-ID:  <201201110158.q0B1wnnC037281@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Wed Jan 11 01:58:49 2012
New Revision: 229955
URL: http://svn.freebsd.org/changeset/base/229955

Log:
  MFC: r228827
  During investigation of an NFSv4 client crash reported by glebius@,
  jhb@ spotted that nfscl_getstateid() might modify credentials when
  called from nfsrpc_read() for the case where p != NULL, whereas
  nfsrpc_read() only did a crdup() to get new credentials for p == NULL.
  This bug was introduced by r195510, since pre-r195510 nfscl_getstateid()
  only modified credentials for the p == NULL case. This patch modifies
  nfsrpc_read()/nfsrpc_write() so that they do crdup() for the p != NULL case.
  It is conceivable that this bug caused the crash reported by glebius@, but
  that will not be determined for some time, since the crash occurred after
  about 1month of operation.

Modified:
  stable/8/sys/fs/nfsclient/nfs_clrpcops.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/fs/nfsclient/nfs_clrpcops.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clrpcops.c	Wed Jan 11 01:42:16 2012	(r229954)
+++ stable/8/sys/fs/nfsclient/nfs_clrpcops.c	Wed Jan 11 01:58:49 2012	(r229955)
@@ -1232,8 +1232,7 @@ nfsrpc_read(vnode_t vp, struct uio *uiop
 	newcred = cred;
 	if (NFSHASNFSV4(nmp)) {
 		nfhp = np->n_fhp;
-		if (p == NULL)
-			newcred = NFSNEWCRED(cred);
+		newcred = NFSNEWCRED(cred);
 	}
 	retrycnt = 0;
 	do {
@@ -1263,7 +1262,7 @@ nfsrpc_read(vnode_t vp, struct uio *uiop
 	     expireret == 0 && clidrev != 0 && retrycnt < 4));
 	if (error && retrycnt >= 4)
 		error = EIO;
-	if (NFSHASNFSV4(nmp) && p == NULL)
+	if (NFSHASNFSV4(nmp))
 		NFSFREECRED(newcred);
 	return (error);
 }
@@ -1384,8 +1383,7 @@ nfsrpc_write(vnode_t vp, struct uio *uio
 		clidrev = nmp->nm_clp->nfsc_clientidrev;
 	newcred = cred;
 	if (NFSHASNFSV4(nmp)) {
-		if (p == NULL)
-			newcred = NFSNEWCRED(cred);
+		newcred = NFSNEWCRED(cred);
 		nfhp = np->n_fhp;
 	}
 	retrycnt = 0;
@@ -1435,7 +1433,7 @@ nfsrpc_write(vnode_t vp, struct uio *uio
 	    ((error == NFSERR_STALESTATEID ||
 	      error == NFSERR_STALEDONTRECOVER) && called_from_strategy != 0)))
 		error = EIO;
-	if (NFSHASNFSV4(nmp) && p == NULL)
+	if (NFSHASNFSV4(nmp))
 		NFSFREECRED(newcred);
 	return (error);
 }



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