svn commit: r248815 - head/sys/vm

Konstantin Belousov kib at FreeBSD.org
Thu Mar 28 06:39:27 UTC 2013


Author: kib
Date: Thu Mar 28 06:39:27 2013
New Revision: 248815
URL: http://svnweb.freebsd.org/changeset/base/248815

Log:
  Release the v_writecount reference on the vnode in case of error,
  before the vnode is vput() in vm_mmap_vnode().  Error return means
  that there is no use reference on the vnode from the vm object
  reference, and failing to restore v_writecount breaks the invariant
  that v_writecount is less or equal to the usecount.
  
  The situation observed when nfs client returns ESTALE for
  VOP_GETATTR() after the open.
  
  In collaboration with:	pho
  MFC after:	1 week

Modified:
  head/sys/vm/vm_mmap.c

Modified: head/sys/vm/vm_mmap.c
==============================================================================
--- head/sys/vm/vm_mmap.c	Thu Mar 28 06:31:04 2013	(r248814)
+++ head/sys/vm/vm_mmap.c	Thu Mar 28 06:39:27 2013	(r248815)
@@ -1345,6 +1345,10 @@ mark_atime:
 	vfs_mark_atime(vp, cred);
 
 done:
+	if (error != 0 && *writecounted) {
+		*writecounted = FALSE;
+		vnode_pager_update_writecount(obj, objsize, 0);
+	}
 	vput(vp);
 	return (error);
 }


More information about the svn-src-all mailing list