Assert that the object type for the vnode' non-NULL v_object, passed

to vnode_pager_setsize(), is either OBJT_VNODE, or, if vnode was
already reclaimed, OBJT_DEAD.  Note that the later is only possible
due to some filesystems, in particular, nfsiods from nfs clients, call
vnode_pager_setsize() with unlocked vnode.

More, if the object is terminated, do not perform the resizing
operation.

Reviewed by:	alc
Tested by:	pho, bf
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2013-04-28 19:19:26 +00:00
parent 3d31767952
commit 9b8851faae
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=250028

View File

@ -380,6 +380,12 @@ vnode_pager_setsize(vp, nsize)
return;
/* ASSERT_VOP_ELOCKED(vp, "vnode_pager_setsize and not locked vnode"); */
VM_OBJECT_WLOCK(object);
if (object->type == OBJT_DEAD) {
VM_OBJECT_WUNLOCK(object);
return;
}
KASSERT(object->type == OBJT_VNODE,
("not vnode-backed object %p", object));
if (nsize == object->un_pager.vnp.vnp_size) {
/*
* Hasn't changed size