nfs: stop using SAVESTART
Only the name is wanted which is already always provided. Reviewed by: rmacklem Tested by: pho, rmacklem Differential Revision: https://reviews.freebsd.org/D34470
This commit is contained in:
parent
269c564b90
commit
65127e982b
@ -1172,7 +1172,6 @@ nfsvno_createsub(struct nfsrv_descript *nd, struct nameidata *ndp,
|
||||
error = nd->nd_repstat;
|
||||
if (!error && ndp->ni_vp == NULL) {
|
||||
if (nvap->na_type == VREG || nvap->na_type == VSOCK) {
|
||||
vrele(ndp->ni_startdir);
|
||||
error = VOP_CREATE(ndp->ni_dvp,
|
||||
&ndp->ni_vp, &ndp->ni_cnd, &nvap->na_vattr);
|
||||
/* For a pNFS server, create the data file on a DS. */
|
||||
@ -1213,7 +1212,6 @@ nfsvno_createsub(struct nfsrv_descript *nd, struct nameidata *ndp,
|
||||
nvap->na_type = VFIFO;
|
||||
if (nvap->na_type != VFIFO &&
|
||||
(error = priv_check_cred(nd->nd_cred, PRIV_VFS_MKNOD_DEV))) {
|
||||
vrele(ndp->ni_startdir);
|
||||
nfsvno_relpathbuf(ndp);
|
||||
vput(ndp->ni_dvp);
|
||||
goto out;
|
||||
@ -1224,11 +1222,9 @@ nfsvno_createsub(struct nfsrv_descript *nd, struct nameidata *ndp,
|
||||
VOP_VPUT_PAIR(ndp->ni_dvp, error == 0 ? &ndp->ni_vp :
|
||||
NULL, false);
|
||||
nfsvno_relpathbuf(ndp);
|
||||
vrele(ndp->ni_startdir);
|
||||
if (error)
|
||||
goto out;
|
||||
} else {
|
||||
vrele(ndp->ni_startdir);
|
||||
nfsvno_relpathbuf(ndp);
|
||||
vput(ndp->ni_dvp);
|
||||
error = ENXIO;
|
||||
@ -1242,7 +1238,6 @@ nfsvno_createsub(struct nfsrv_descript *nd, struct nameidata *ndp,
|
||||
* 1 - clean up the lookup
|
||||
* 2 - iff !error and na_size set, truncate it
|
||||
*/
|
||||
vrele(ndp->ni_startdir);
|
||||
nfsvno_relpathbuf(ndp);
|
||||
*vpp = ndp->ni_vp;
|
||||
if (ndp->ni_dvp == *vpp)
|
||||
@ -1285,7 +1280,6 @@ nfsvno_mknod(struct nameidata *ndp, struct nfsvattr *nvap, struct ucred *cred,
|
||||
* Iff doesn't exist, create it.
|
||||
*/
|
||||
if (ndp->ni_vp) {
|
||||
vrele(ndp->ni_startdir);
|
||||
nfsvno_relpathbuf(ndp);
|
||||
vput(ndp->ni_dvp);
|
||||
vrele(ndp->ni_vp);
|
||||
@ -1293,14 +1287,12 @@ nfsvno_mknod(struct nameidata *ndp, struct nfsvattr *nvap, struct ucred *cred,
|
||||
goto out;
|
||||
}
|
||||
if (vtyp != VCHR && vtyp != VBLK && vtyp != VSOCK && vtyp != VFIFO) {
|
||||
vrele(ndp->ni_startdir);
|
||||
nfsvno_relpathbuf(ndp);
|
||||
vput(ndp->ni_dvp);
|
||||
error = NFSERR_BADTYPE;
|
||||
goto out;
|
||||
}
|
||||
if (vtyp == VSOCK) {
|
||||
vrele(ndp->ni_startdir);
|
||||
error = VOP_CREATE(ndp->ni_dvp, &ndp->ni_vp,
|
||||
&ndp->ni_cnd, &nvap->na_vattr);
|
||||
VOP_VPUT_PAIR(ndp->ni_dvp, error == 0 ? &ndp->ni_vp : NULL,
|
||||
@ -1309,7 +1301,6 @@ nfsvno_mknod(struct nameidata *ndp, struct nfsvattr *nvap, struct ucred *cred,
|
||||
} else {
|
||||
if (nvap->na_type != VFIFO &&
|
||||
(error = priv_check_cred(cred, PRIV_VFS_MKNOD_DEV))) {
|
||||
vrele(ndp->ni_startdir);
|
||||
nfsvno_relpathbuf(ndp);
|
||||
vput(ndp->ni_dvp);
|
||||
goto out;
|
||||
@ -1319,7 +1310,6 @@ nfsvno_mknod(struct nameidata *ndp, struct nfsvattr *nvap, struct ucred *cred,
|
||||
VOP_VPUT_PAIR(ndp->ni_dvp, error == 0 ? &ndp->ni_vp : NULL,
|
||||
false);
|
||||
nfsvno_relpathbuf(ndp);
|
||||
vrele(ndp->ni_startdir);
|
||||
/*
|
||||
* Since VOP_MKNOD returns the ni_vp, I can't
|
||||
* see any reason to do the lookup.
|
||||
@ -1371,7 +1361,6 @@ nfsvno_symlink(struct nameidata *ndp, struct nfsvattr *nvap, char *pathcp,
|
||||
int error = 0;
|
||||
|
||||
if (ndp->ni_vp) {
|
||||
vrele(ndp->ni_startdir);
|
||||
nfsvno_relpathbuf(ndp);
|
||||
if (ndp->ni_dvp == ndp->ni_vp)
|
||||
vrele(ndp->ni_dvp);
|
||||
@ -1391,7 +1380,6 @@ nfsvno_symlink(struct nameidata *ndp, struct nfsvattr *nvap, char *pathcp,
|
||||
* Just vput it for v2.
|
||||
*/
|
||||
VOP_VPUT_PAIR(ndp->ni_dvp, &ndp->ni_vp, !not_v2 && error == 0);
|
||||
vrele(ndp->ni_startdir);
|
||||
nfsvno_relpathbuf(ndp);
|
||||
|
||||
out:
|
||||
@ -1642,10 +1630,8 @@ nfsvno_rename(struct nameidata *fromndp, struct nameidata *tondp,
|
||||
NFSD_DEBUG(4, "nfsvno_rename: pnfsremove\n");
|
||||
}
|
||||
|
||||
vrele(tondp->ni_startdir);
|
||||
nfsvno_relpathbuf(tondp);
|
||||
out1:
|
||||
vrele(fromndp->ni_startdir);
|
||||
nfsvno_relpathbuf(fromndp);
|
||||
NFSEXITCODE(error);
|
||||
return (error);
|
||||
@ -1862,7 +1848,6 @@ nfsvno_open(struct nfsrv_descript *nd, struct nameidata *ndp,
|
||||
stateidp, stp, NULL, nd, p, nd->nd_repstat);
|
||||
if (!nd->nd_repstat) {
|
||||
if (ndp->ni_vp == NULL) {
|
||||
vrele(ndp->ni_startdir);
|
||||
nd->nd_repstat = VOP_CREATE(ndp->ni_dvp,
|
||||
&ndp->ni_vp, &ndp->ni_cnd, &nvap->na_vattr);
|
||||
/* For a pNFS server, create the data file on a DS. */
|
||||
@ -1900,8 +1885,6 @@ nfsvno_open(struct nfsrv_descript *nd, struct nameidata *ndp,
|
||||
}
|
||||
vp = ndp->ni_vp;
|
||||
} else {
|
||||
if (ndp->ni_startdir)
|
||||
vrele(ndp->ni_startdir);
|
||||
nfsvno_relpathbuf(ndp);
|
||||
vp = ndp->ni_vp;
|
||||
if (create == NFSV4OPEN_CREATE) {
|
||||
@ -1935,8 +1918,7 @@ nfsvno_open(struct nfsrv_descript *nd, struct nameidata *ndp,
|
||||
}
|
||||
} else {
|
||||
nfsvno_relpathbuf(ndp);
|
||||
if (ndp->ni_startdir && create == NFSV4OPEN_CREATE) {
|
||||
vrele(ndp->ni_startdir);
|
||||
if (create == NFSV4OPEN_CREATE) {
|
||||
if (ndp->ni_dvp == ndp->ni_vp)
|
||||
vrele(ndp->ni_dvp);
|
||||
else
|
||||
@ -4186,7 +4168,7 @@ nfsrv_dscreate(struct vnode *dvp, struct vattr *vap, struct vattr *nvap,
|
||||
int error;
|
||||
|
||||
NFSNAMEICNDSET(&named.ni_cnd, tcred, CREATE,
|
||||
LOCKPARENT | LOCKLEAF | SAVESTART | NOCACHE);
|
||||
LOCKPARENT | LOCKLEAF | NOCACHE);
|
||||
nfsvno_setpathbuf(&named, &bufp, &hashp);
|
||||
named.ni_cnd.cn_lkflags = LK_EXCLUSIVE;
|
||||
named.ni_cnd.cn_nameptr = bufp;
|
||||
|
@ -611,7 +611,7 @@ nfsrvd_lookup(struct nfsrv_descript *nd, __unused int isdgram,
|
||||
}
|
||||
|
||||
NFSNAMEICNDSET(&named.ni_cnd, nd->nd_cred, LOOKUP,
|
||||
LOCKLEAF | SAVESTART);
|
||||
LOCKLEAF);
|
||||
nfsvno_setpathbuf(&named, &bufp, &hashp);
|
||||
error = nfsrv_parsename(nd, bufp, hashp, &named.ni_pathlen);
|
||||
if (error) {
|
||||
@ -636,8 +636,6 @@ nfsrvd_lookup(struct nfsrv_descript *nd, __unused int isdgram,
|
||||
nfsrv_postopattr(nd, dattr_ret, &dattr);
|
||||
goto out;
|
||||
}
|
||||
if (named.ni_startdir)
|
||||
vrele(named.ni_startdir);
|
||||
nfsvno_relpathbuf(&named);
|
||||
vp = named.ni_vp;
|
||||
if ((nd->nd_flag & ND_NFSV4) != 0 && !NFSVNO_EXPORTED(exp) &&
|
||||
@ -1160,7 +1158,7 @@ nfsrvd_create(struct nfsrv_descript *nd, __unused int isdgram,
|
||||
goto out;
|
||||
}
|
||||
NFSNAMEICNDSET(&named.ni_cnd, nd->nd_cred, CREATE,
|
||||
LOCKPARENT | LOCKLEAF | SAVESTART | NOCACHE);
|
||||
LOCKPARENT | LOCKLEAF | NOCACHE);
|
||||
nfsvno_setpathbuf(&named, &bufp, &hashp);
|
||||
error = nfsrv_parsename(nd, bufp, hashp, &named.ni_pathlen);
|
||||
if (error)
|
||||
@ -1325,7 +1323,7 @@ nfsrvd_mknod(struct nfsrv_descript *nd, __unused int isdgram,
|
||||
struct thread *p = curthread;
|
||||
|
||||
NFSVNO_ATTRINIT(&nva);
|
||||
cnflags = (LOCKPARENT | SAVESTART);
|
||||
cnflags = LOCKPARENT;
|
||||
if (nd->nd_repstat) {
|
||||
nfsrv_wcc(nd, dirfor_ret, &dirfor, diraft_ret, &diraft);
|
||||
goto out;
|
||||
@ -1633,7 +1631,7 @@ nfsrvd_rename(struct nfsrv_descript *nd, int isdgram,
|
||||
fdirfor_ret = nfsvno_getattr(dp, &fdirfor, nd, p, 1, NULL);
|
||||
tond.ni_cnd.cn_nameiop = 0;
|
||||
tond.ni_startdir = NULL;
|
||||
NFSNAMEICNDSET(&fromnd.ni_cnd, nd->nd_cred, DELETE, WANTPARENT | SAVESTART);
|
||||
NFSNAMEICNDSET(&fromnd.ni_cnd, nd->nd_cred, DELETE, WANTPARENT);
|
||||
nfsvno_setpathbuf(&fromnd, &bufp, &hashp);
|
||||
error = nfsrv_parsename(nd, bufp, hashp, &fromnd.ni_pathlen);
|
||||
if (error) {
|
||||
@ -1694,7 +1692,7 @@ nfsrvd_rename(struct nfsrv_descript *nd, int isdgram,
|
||||
}
|
||||
}
|
||||
}
|
||||
NFSNAMEICNDSET(&tond.ni_cnd, nd->nd_cred, RENAME, LOCKPARENT | LOCKLEAF | NOCACHE | SAVESTART);
|
||||
NFSNAMEICNDSET(&tond.ni_cnd, nd->nd_cred, RENAME, LOCKPARENT | LOCKLEAF | NOCACHE);
|
||||
nfsvno_setpathbuf(&tond, &tbufp, &hashp);
|
||||
if (!nd->nd_repstat) {
|
||||
error = nfsrv_parsename(nd, tbufp, hashp, &tond.ni_pathlen);
|
||||
@ -1900,7 +1898,7 @@ nfsrvd_symlink(struct nfsrv_descript *nd, __unused int isdgram,
|
||||
*vpp = NULL;
|
||||
NFSVNO_ATTRINIT(&nva);
|
||||
NFSNAMEICNDSET(&named.ni_cnd, nd->nd_cred, CREATE,
|
||||
LOCKPARENT | SAVESTART | NOCACHE);
|
||||
LOCKPARENT | NOCACHE);
|
||||
nfsvno_setpathbuf(&named, &bufp, &hashp);
|
||||
error = nfsrv_parsename(nd, bufp, hashp, &named.ni_pathlen);
|
||||
if (!error && !nd->nd_repstat)
|
||||
@ -3018,10 +3016,10 @@ nfsrvd_open(struct nfsrv_descript *nd, __unused int isdgram,
|
||||
}
|
||||
if (create == NFSV4OPEN_CREATE)
|
||||
NFSNAMEICNDSET(&named.ni_cnd, nd->nd_cred, CREATE,
|
||||
LOCKPARENT | LOCKLEAF | SAVESTART | NOCACHE);
|
||||
LOCKPARENT | LOCKLEAF | NOCACHE);
|
||||
else
|
||||
NFSNAMEICNDSET(&named.ni_cnd, nd->nd_cred, LOOKUP,
|
||||
LOCKLEAF | SAVESTART);
|
||||
LOCKLEAF);
|
||||
nfsvno_setpathbuf(&named, &bufp, &hashp);
|
||||
error = nfsrv_parsename(nd, bufp, hashp, &named.ni_pathlen);
|
||||
if (error) {
|
||||
@ -3687,7 +3685,7 @@ nfsrvd_secinfo(struct nfsrv_descript *nd, int isdgram,
|
||||
* All this just to get the export flags for the name.
|
||||
*/
|
||||
NFSNAMEICNDSET(&named.ni_cnd, nd->nd_cred, LOOKUP,
|
||||
LOCKLEAF | SAVESTART);
|
||||
LOCKLEAF);
|
||||
nfsvno_setpathbuf(&named, &bufp, &hashp);
|
||||
error = nfsrv_parsename(nd, bufp, hashp, &named.ni_pathlen);
|
||||
if (error) {
|
||||
@ -3705,7 +3703,6 @@ nfsrvd_secinfo(struct nfsrv_descript *nd, int isdgram,
|
||||
vrele(dirp);
|
||||
if (nd->nd_repstat)
|
||||
goto out;
|
||||
vrele(named.ni_startdir);
|
||||
nfsvno_relpathbuf(&named);
|
||||
fh.nfsrvfh_len = NFSX_MYFH;
|
||||
vp = named.ni_vp;
|
||||
@ -3826,7 +3823,7 @@ nfsrvd_secinfononame(struct nfsrv_descript *nd, int isdgram,
|
||||
goto nfsmout;
|
||||
}
|
||||
NFSNAMEICNDSET(&named.ni_cnd, nd->nd_cred, LOOKUP,
|
||||
LOCKLEAF | SAVESTART);
|
||||
LOCKLEAF);
|
||||
nfsvno_setpathbuf(&named, &bufp, &hashp);
|
||||
error = nfsrv_parsename(nd, bufp, hashp, &named.ni_pathlen);
|
||||
if (error != 0) {
|
||||
@ -3840,7 +3837,6 @@ nfsrvd_secinfononame(struct nfsrv_descript *nd, int isdgram,
|
||||
vput(dp);
|
||||
if (dirp != NULL)
|
||||
vrele(dirp);
|
||||
vrele(named.ni_startdir);
|
||||
nfsvno_relpathbuf(&named);
|
||||
vp = named.ni_vp;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user