FreeBSD: vn_flush_cached_data: observe vnode locking contract
vm_object_page_clean() expects that the associated vnode is locked as VOP_PUTPAGES() may get called on the vnode. Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Andriy Gapon <avg@FreeBSD.org> Closes #14079
This commit is contained in:
parent
eeddd80572
commit
41133c9794
|
@ -96,9 +96,11 @@ vn_flush_cached_data(vnode_t *vp, boolean_t sync)
|
||||||
if (vp->v_object->flags & OBJ_MIGHTBEDIRTY) {
|
if (vp->v_object->flags & OBJ_MIGHTBEDIRTY) {
|
||||||
#endif
|
#endif
|
||||||
int flags = sync ? OBJPC_SYNC : 0;
|
int flags = sync ? OBJPC_SYNC : 0;
|
||||||
|
vn_lock(vp, LK_SHARED | LK_RETRY);
|
||||||
zfs_vmobject_wlock(vp->v_object);
|
zfs_vmobject_wlock(vp->v_object);
|
||||||
vm_object_page_clean(vp->v_object, 0, 0, flags);
|
vm_object_page_clean(vp->v_object, 0, 0, flags);
|
||||||
zfs_vmobject_wunlock(vp->v_object);
|
zfs_vmobject_wunlock(vp->v_object);
|
||||||
|
VOP_UNLOCK(vp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue