svn commit: r268580 - stable/10/sys/fs/nfsclient
Rick Macklem
rmacklem at FreeBSD.org
Sun Jul 13 00:19:40 UTC 2014
Author: rmacklem
Date: Sun Jul 13 00:19:39 2014
New Revision: 268580
URL: http://svnweb.freebsd.org/changeset/base/268580
Log:
MFC: r268008
There might be a potential race condition for the NFSv4 client
when a newly created file has another open done on it that
update the open mode. This patch moves the code that updates
the open mode up into the block where the mutex is held to
ensure this cannot happen. No bug caused by this potential
race has been observed, but this fix is a safety belt to ensure
it cannot happen.
Modified:
stable/10/sys/fs/nfsclient/nfs_clstate.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/fs/nfsclient/nfs_clstate.c
==============================================================================
--- stable/10/sys/fs/nfsclient/nfs_clstate.c Sat Jul 12 23:27:38 2014 (r268579)
+++ stable/10/sys/fs/nfsclient/nfs_clstate.c Sun Jul 13 00:19:39 2014 (r268580)
@@ -281,6 +281,23 @@ nfscl_open(vnode_t vp, u_int8_t *nfhp, i
newonep);
/*
+ * Now, check the mode on the open and return the appropriate
+ * value.
+ */
+ if (retp != NULL) {
+ if (nfhp != NULL && dp != NULL && nop == NULL)
+ /* new local open on delegation */
+ *retp = NFSCLOPEN_SETCRED;
+ else
+ *retp = NFSCLOPEN_OK;
+ }
+ if (op != NULL && (amode & ~(op->nfso_mode))) {
+ op->nfso_mode |= amode;
+ if (retp != NULL && dp == NULL)
+ *retp = NFSCLOPEN_DOOPEN;
+ }
+
+ /*
* Serialize modifications to the open owner for multiple threads
* within the same process using a read/write sleep lock.
*/
@@ -295,23 +312,6 @@ nfscl_open(vnode_t vp, u_int8_t *nfhp, i
*owpp = owp;
if (opp != NULL)
*opp = op;
- if (retp != NULL) {
- if (nfhp != NULL && dp != NULL && nop == NULL)
- /* new local open on delegation */
- *retp = NFSCLOPEN_SETCRED;
- else
- *retp = NFSCLOPEN_OK;
- }
-
- /*
- * Now, check the mode on the open and return the appropriate
- * value.
- */
- if (op != NULL && (amode & ~(op->nfso_mode))) {
- op->nfso_mode |= amode;
- if (retp != NULL && dp == NULL)
- *retp = NFSCLOPEN_DOOPEN;
- }
return (0);
}
More information about the svn-src-stable
mailing list