Skip to content

Commit

Permalink
FreeBSD: vn_flush_cached_data: observe vnode locking contract
Browse files Browse the repository at this point in the history
vm_object_page_clean() expects that the associated vnode is locked
as VOP_PUTPAGES() may get called on the vnode.

Reviewed-by: Ryan Moeller <[email protected]>
Signed-off-by: Andriy Gapon <[email protected]>
Closes openzfs#14079
  • Loading branch information
avg-I authored and andrewc12 committed Nov 9, 2022
1 parent 337bbba commit f97bbbf
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/os/freebsd/spl/sys/vnode.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ vn_flush_cached_data(vnode_t *vp, boolean_t sync)
if (vp->v_object->flags & OBJ_MIGHTBEDIRTY) {
#endif
int flags = sync ? OBJPC_SYNC : 0;
vn_lock(vp, LK_SHARED | LK_RETRY);
zfs_vmobject_wlock(vp->v_object);
vm_object_page_clean(vp->v_object, 0, 0, flags);
zfs_vmobject_wunlock(vp->v_object);
VOP_UNLOCK(vp);
}
}
#endif
Expand Down

0 comments on commit f97bbbf

Please sign in to comment.