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
This commit is contained in:
Konstantin Belousov 2013-03-28 06:39:27 +00:00
parent 09ac4e68f3
commit bafa6cfc93
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=248815

View File

@ -1345,6 +1345,10 @@ vm_mmap_vnode(struct thread *td, vm_size_t objsize,
vfs_mark_atime(vp, cred);
done:
if (error != 0 && *writecounted) {
*writecounted = FALSE;
vnode_pager_update_writecount(obj, objsize, 0);
}
vput(vp);
return (error);
}