From ebba1b25f9e8f4cf0dc003b348e0e4be388b72f6 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Thu, 1 May 2003 03:10:38 +0000 Subject: [PATCH] Lock accesses to the vm_object's ref_count and resident_page_count. --- sys/kern/vfs_subr.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index bd02030ebe2..ea958ac591b 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -829,11 +829,15 @@ vcanrecycle(struct vnode *vp, struct mount **vnmpp) /* * Don't recycle if we still have cached pages. */ - if (VOP_GETVOBJECT(vp, &object) == 0 && - (object->resident_page_count || - object->ref_count)) { - error = EBUSY; - goto done; + if (VOP_GETVOBJECT(vp, &object) == 0) { + VM_OBJECT_LOCK(object); + if (object->resident_page_count || + object->ref_count) { + VM_OBJECT_UNLOCK(object); + error = EBUSY; + goto done; + } + VM_OBJECT_UNLOCK(object); } if (LIST_FIRST(&vp->v_cache_src)) { /*