Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Mar 2013 06:39:27 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r248815 - head/sys/vm
Message-ID:  <201303280639.r2S6dRiR029307@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }



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