diff options
Diffstat (limited to 'sys/kern/vfs_subr.c')
-rw-r--r-- | sys/kern/vfs_subr.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index bd02030..ea958ac 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)) { /* |