vfs: stop using NDFREE

It provides nothing but a branchfest and next to no consumers want it
anyway.

Tested by:	pho
This commit is contained in:
Mateusz Guzik 2022-11-17 16:58:28 +00:00
parent 77e4249319
commit 85dac03e30
5 changed files with 21 additions and 12 deletions

View File

@ -380,7 +380,8 @@ kern___acl_get_path(struct thread *td, const char *path, acl_type_t type,
error = namei(&nd); error = namei(&nd);
if (error == 0) { if (error == 0) {
error = vacl_get_acl(td, nd.ni_vp, type, aclp); error = vacl_get_acl(td, nd.ni_vp, type, aclp);
NDFREE(&nd, 0); vrele(nd.ni_vp);
NDFREE_PNBUF(&nd);
} }
return (error); return (error);
} }
@ -418,7 +419,8 @@ kern___acl_set_path(struct thread *td, const char *path,
error = namei(&nd); error = namei(&nd);
if (error == 0) { if (error == 0) {
error = vacl_set_acl(td, nd.ni_vp, type, aclp); error = vacl_set_acl(td, nd.ni_vp, type, aclp);
NDFREE(&nd, 0); vrele(nd.ni_vp);
NDFREE_PNBUF(&nd);
} }
return (error); return (error);
} }
@ -494,7 +496,8 @@ kern___acl_delete_path(struct thread *td, const char *path,
error = namei(&nd); error = namei(&nd);
if (error == 0) { if (error == 0) {
error = vacl_delete(td, nd.ni_vp, type); error = vacl_delete(td, nd.ni_vp, type);
NDFREE(&nd, 0); vrele(nd.ni_vp);
NDFREE_PNBUF(&nd);
} }
return (error); return (error);
} }
@ -551,7 +554,7 @@ kern___acl_aclcheck_path(struct thread *td, const char *path, acl_type_t type,
error = namei(&nd); error = namei(&nd);
if (error == 0) { if (error == 0) {
error = vacl_aclcheck(td, nd.ni_vp, type, aclp); error = vacl_aclcheck(td, nd.ni_vp, type, aclp);
NDFREE(&nd, 0); NDFREE_PNBUF(&nd);
} }
return (error); return (error);
} }

View File

@ -3153,7 +3153,9 @@ kern___realpathat(struct thread *td, int fd, const char *path, char *buf,
error = copyout(retbuf, buf, size); error = copyout(retbuf, buf, size);
free(freebuf, M_TEMP); free(freebuf, M_TEMP);
} }
NDFREE(&nd, 0); vrele(nd.ni_vp);
vrele(nd.ni_dvp);
NDFREE_PNBUF(&nd);
return (error); return (error);
} }

View File

@ -108,7 +108,7 @@ sys_extattrctl(struct thread *td, struct extattrctl_args *uap)
if (error) if (error)
return (error); return (error);
filename_vp = nd.ni_vp; filename_vp = nd.ni_vp;
NDFREE(&nd, NDF_NO_VP_RELE); NDFREE_PNBUF(&nd);
} }
/* uap->path is always defined. */ /* uap->path is always defined. */
@ -120,13 +120,15 @@ sys_extattrctl(struct thread *td, struct extattrctl_args *uap)
mp = nd.ni_vp->v_mount; mp = nd.ni_vp->v_mount;
error = vfs_busy(mp, 0); error = vfs_busy(mp, 0);
if (error) { if (error) {
NDFREE(&nd, 0); vput(nd.ni_vp);
NDFREE_PNBUF(&nd);
mp = NULL; mp = NULL;
goto out; goto out;
} }
VOP_UNLOCK(nd.ni_vp); VOP_UNLOCK(nd.ni_vp);
error = vn_start_write(nd.ni_vp, &mp_writable, V_WAIT | V_PCATCH); error = vn_start_write(nd.ni_vp, &mp_writable, V_WAIT | V_PCATCH);
NDFREE(&nd, NDF_NO_VP_UNLOCK); vrele(nd.ni_vp);
NDFREE_PNBUF(&nd);
if (error) if (error)
goto out; goto out;
if (filename_vp != NULL) { if (filename_vp != NULL) {

View File

@ -415,7 +415,8 @@ sysctl_try_reclaim_vnode(SYSCTL_HANDLER_ARGS)
counter_u64_add(recycles_count, 1); counter_u64_add(recycles_count, 1);
vgone(vp); vgone(vp);
putvnode: putvnode:
NDFREE(&nd, 0); vput(vp);
NDFREE_PNBUF(&nd);
out: out:
free(buf, M_TEMP); free(buf, M_TEMP);
return (error); return (error);

View File

@ -369,7 +369,8 @@ kern___mac_get_path(struct thread *td, const char *path_p, struct mac *mac_p,
mac_vnode_copy_label(nd.ni_vp->v_label, intlabel); mac_vnode_copy_label(nd.ni_vp->v_label, intlabel);
error = mac_vnode_externalize_label(intlabel, elements, buffer, error = mac_vnode_externalize_label(intlabel, elements, buffer,
mac.m_buflen); mac.m_buflen);
NDFREE(&nd, 0); vput(nd.ni_vp);
NDFREE_PNBUF(&nd);
mac_vnode_label_free(intlabel); mac_vnode_label_free(intlabel);
if (error == 0) if (error == 0)
@ -542,9 +543,9 @@ kern___mac_set_path(struct thread *td, const char *path_p, struct mac *mac_p,
td->td_ucred); td->td_ucred);
vn_finished_write(mp); vn_finished_write(mp);
} }
vput(nd.ni_vp);
NDFREE_PNBUF(&nd);
} }
NDFREE(&nd, 0);
out: out:
mac_vnode_label_free(intlabel); mac_vnode_label_free(intlabel);
return (error); return (error);