Initialize zfs vnode v_hash when the vnode is allocated, instead of
postponing it to zfs_vget(). zfs_root() returned vnode with the default value of v_hash, which caused inconsistent v_hash value when root vnode was obtained from zfs_vget(). Nullfs allocated two upper vnodes for the root zfs vnode due to different hashes, causing consistency problems. Reported and tested by: Harald Schmalzbauer <h.schmalzbauer@omnilan.de> Sponsored by: The FreeBSD Foundation MFC after: 1 week
This commit is contained in:
parent
9a0f8af7d4
commit
fe0e9a63e0
@ -2075,8 +2075,6 @@ zfs_vget(vfs_t *vfsp, ino_t ino, int flags, vnode_t **vpp)
|
||||
err = vn_lock(*vpp, flags);
|
||||
if (err != 0)
|
||||
*vpp = NULL;
|
||||
else
|
||||
(*vpp)->v_hash = ino;
|
||||
return (err);
|
||||
}
|
||||
|
||||
|
@ -1228,9 +1228,10 @@ again:
|
||||
vnode_t *vp = ZTOV(zp);
|
||||
|
||||
err = insmntque(vp, zfsvfs->z_vfs);
|
||||
if (err == 0)
|
||||
if (err == 0) {
|
||||
vp->v_hash = obj_num;
|
||||
VOP_UNLOCK(vp, 0);
|
||||
else {
|
||||
} else {
|
||||
zp->z_vnode = NULL;
|
||||
zfs_znode_dmu_fini(zp);
|
||||
zfs_znode_free(zp);
|
||||
|
Loading…
x
Reference in New Issue
Block a user