[Midnightbsd-cvs] src [9031] trunk/sys/fs/nfsclient/nfs_clport.c: release teh v_writecount ref on the vnode in case of error.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Oct 1 05:46:22 EDT 2016


Revision: 9031
          http://svnweb.midnightbsd.org/src/?rev=9031
Author:   laffer1
Date:     2016-10-01 05:46:22 -0400 (Sat, 01 Oct 2016)
Log Message:
-----------
release teh v_writecount ref on the vnode in case of error.

Modified Paths:
--------------
    trunk/sys/fs/nfsclient/nfs_clport.c

Modified: trunk/sys/fs/nfsclient/nfs_clport.c
===================================================================
--- trunk/sys/fs/nfsclient/nfs_clport.c	2016-10-01 09:45:48 UTC (rev 9030)
+++ trunk/sys/fs/nfsclient/nfs_clport.c	2016-10-01 09:46:22 UTC (rev 9031)
@@ -367,6 +367,8 @@
 	struct nfsnode *np;
 	struct nfsmount *nmp;
 	struct timespec mtime_save;
+	u_quad_t nsize;
+	int setnsize;
 
 	/*
 	 * If v_type == VNON it is a new node, so fill in the v_type,
@@ -424,6 +426,8 @@
 	} else
 		vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0];
 	np->n_attrstamp = time_second;
+	setnsize = 0;
+	nsize = 0;
 	if (vap->va_size != np->n_size) {
 		if (vap->va_type == VREG) {
 			if (dontshrink && vap->va_size < np->n_size) {
@@ -450,10 +454,13 @@
 				np->n_size = vap->va_size;
 				np->n_flag |= NSIZECHANGED;
 			}
-			vnode_pager_setsize(vp, np->n_size);
 		} else {
 			np->n_size = vap->va_size;
 		}
+		if (vap->va_type == VREG || vap->va_type == VDIR) {
+			setnsize = 1;
+			nsize = vap->va_size;
+		}
 	}
 	/*
 	 * The following checks are added to prevent a race between (say)
@@ -486,6 +493,8 @@
 		KDTRACE_NFS_ATTRCACHE_LOAD_DONE(vp, vap, 0);
 #endif
 	NFSUNLOCKNODE(np);
+	if (setnsize)
+		vnode_pager_setsize(vp, nsize);
 	return (0);
 }
 



More information about the Midnightbsd-cvs mailing list