Skip to content

Commit

Permalink
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.

Signed-off-by: Andriy Gapon <[email protected]>
  • Loading branch information
avg-I committed Oct 24, 2022
1 parent 0b2428d commit 3355a3a
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_EXCLUSIVE | 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 3355a3a

Please sign in to comment.