Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix zfs_xattr_owner_unlinked on FreeBSD and comment #9720

Merged
merged 1 commit into from
Dec 16, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions module/zfs/zfs_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,13 @@ zfs_xattr_owner_unlinked(znode_t *zp)
int unlinked = 0;
znode_t *dzp;

/*
* zrele drops the vnode lock which violates the VOP locking contract
* on FreeBSD. See comment at the top of zfs_replay.c for more detail.
*/
#ifndef __FreeBSD__
zhold(zp);
#endif
/*
* if zp is XATTR node, keep walking up via z_xattr_parent until we
* get the owner
Expand All @@ -247,7 +253,9 @@ zfs_xattr_owner_unlinked(znode_t *zp)
zp = dzp;
unlinked = zp->z_unlinked;
}
#ifndef __FreeBSD__
zrele(zp);
#endif
return (unlinked);
}

Expand Down
10 changes: 10 additions & 0 deletions module/zfs/zfs_replay.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@
#include <sys/cred.h>
#include <sys/zpl.h>

/*
* NB: FreeBSD expects to be able to do vnode locking in lookup and
* hold the locks across all subsequent VOPs until vput is called.
* This means that its zfs vnops routines can't do any internal locking.
* In order to have the same contract as the Linux vnops there would
* needed to be duplicate locked vnops. If the vnops were used more widely
* in common code this would likely be preferable. However, currently
* this is the only file where this is the case.
*/

/*
* Functions to replay ZFS intent log (ZIL) records
* The functions are called through a function vector (zfs_replay_vector)
Expand Down