In vm_page_cache(), only drop the vnode after radix insert failure

for empty page cache when the object type if OBJT_VNODE.

Reported and tested by:	pho
Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2016-05-24 19:20:30 +00:00
parent 3c048026b5
commit 0e38422096

View File

@ -3290,7 +3290,8 @@ vm_page_cache(vm_page_t m)
cache_was_empty = vm_radix_is_empty(&object->cache);
if (vm_radix_insert(&object->cache, m)) {
mtx_unlock(&vm_page_queue_free_mtx);
if (object->resident_page_count == 0)
if (object->type == OBJT_VNODE &&
object->resident_page_count == 0)
vdrop(object->handle);
m->object = NULL;
vm_page_free(m);