Skip to content

Commit

Permalink
Do not hold parentvp for XATTRs
Browse files Browse the repository at this point in the history
Signed-off-by: Jorgen Lundman <[email protected]>
  • Loading branch information
lundman committed Sep 11, 2023
1 parent a84ebb5 commit 238b41d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
7 changes: 2 additions & 5 deletions module/os/windows/spl/spl-vnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,7 @@ vnode_setparent(vnode_t *vp, vnode_t *newparent)
vnode_rele(oldparent);
if (!error)
VN_RELE(oldparent);
VN_RELE(oldparent);
}
}

Expand Down Expand Up @@ -1294,7 +1295,7 @@ vnode_create(mount_t *mp, struct vnode *dvp, void *v_data, int type, int flags,
*vpp = vp;
vp->v_flags = 0;
vp->v_mount = mp;
vp->v_parent = dvp;
vp->v_parent = NULL;
vp->v_data = v_data;
vp->v_type = type;
vp->v_id = atomic_inc_64_nv(&(vnode_vid_counter));
Expand All @@ -1312,10 +1313,6 @@ vnode_create(mount_t *mp, struct vnode *dvp, void *v_data, int type, int flags,
if (flags & VNODE_MARKROOT)
vp->v_flags |= VNODE_MARKROOT;

/* We also get here with xdvp on the file, can be NULL */
if (dvp != NULL && vnode_isdir(dvp))
vnode_ref(dvp);

// Initialise the Windows specific data.
memset(&vp->SectionObjectPointers, 0,
sizeof (vp->SectionObjectPointers));
Expand Down
9 changes: 8 additions & 1 deletion module/os/windows/zfs/zfs_vnops_windows.c
Original file line number Diff line number Diff line change
Expand Up @@ -1962,8 +1962,15 @@ zfs_znode_getvnode(znode_t *zp, znode_t *dzp, zfsvfs_t *zfsvfs)
vnode_create(zfsvfs->z_vfs, parentvp,
zp, IFTOVT((mode_t)zp->z_mode), flags, &vp);

if (parentvp != NULL)
/* We also get here with xdvp on the file, can be NULL */
if (parentvp != NULL) {

if (vnode_isdir(parentvp) &&
!(zp->z_mode & ZFS_XATTR))
vnode_setparent(vp, parentvp);

VN_RELE(parentvp);
}

atomic_inc_64(&vnop_num_vnodes);

Expand Down
1 change: 1 addition & 0 deletions module/os/windows/zfs/zfs_vnops_windows_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -2836,6 +2836,7 @@ zfs_parent(struct vnode *vp)
if (error)
return (SET_ERROR(NULL));

vnode_setparent(vp, ZTOV(dzp));
return (ZTOV(dzp));
}

Expand Down

0 comments on commit 238b41d

Please sign in to comment.