diff options
author | kib <kib@FreeBSD.org> | 2013-04-28 19:25:09 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2013-04-28 19:25:09 +0000 |
commit | d4d37d6d8889403ad1350f932cbb9421b9b6023d (patch) | |
tree | eab8c64a9ac67fa54d6074b6926472ab85af746d /sys/vm/vm_object.c | |
parent | dae393576885009863cdf2f416eba41391fa7712 (diff) | |
download | FreeBSD-src-d4d37d6d8889403ad1350f932cbb9421b9b6023d.zip FreeBSD-src-d4d37d6d8889403ad1350f932cbb9421b9b6023d.tar.gz |
Make vm_object_page_clean() and vm_mmap_vnode() tolerate the vnode'
v_object of non OBJT_VNODE type.
For vm_object_page_clean(), simply do not assert that object type must
be OBJT_VNODE, and add a comment explaining how the check for
OBJ_MIGHTBEDIRTY prevents the rest of function from operating on such
objects.
For vm_mmap_vnode(), if the object type is not OBJT_VNODE, require it
to be for swap pager (or default), handle the bypass filesystems, and
correctly acquire the object reference in this case.
Reviewed by: alc
Tested by: pho, bf
MFC after: 1 week
Diffstat (limited to 'sys/vm/vm_object.c')
-rw-r--r-- | sys/vm/vm_object.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/vm/vm_object.c b/sys/vm/vm_object.c index 3d9ec61..1f7cb78 100644 --- a/sys/vm/vm_object.c +++ b/sys/vm/vm_object.c @@ -820,7 +820,12 @@ vm_object_page_clean(vm_object_t object, vm_ooffset_t start, vm_ooffset_t end, boolean_t clearobjflags, eio, res; VM_OBJECT_ASSERT_WLOCKED(object); - KASSERT(object->type == OBJT_VNODE, ("Not a vnode object")); + + /* + * The OBJ_MIGHTBEDIRTY flag is only set for OBJT_VNODE + * objects. The check below prevents the function from + * operating on non-vnode objects. + */ if ((object->flags & OBJ_MIGHTBEDIRTY) == 0 || object->resident_page_count == 0) return (TRUE); |