Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/nfsclient/nfs_clrpcops.c.write
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 3,621 Lines • ▼ Show 20 Lines | nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsuint64 *cookiep, | ||||
int attrflag, tryformoredirs = 1, eof = 0, gotmnton = 0; | int attrflag, tryformoredirs = 1, eof = 0, gotmnton = 0; | ||||
int isdotdot = 0, unlocknewvp = 0; | int isdotdot = 0, unlocknewvp = 0; | ||||
u_int64_t dotfileid, dotdotfileid = 0, fakefileno = UINT64_MAX; | u_int64_t dotfileid, dotdotfileid = 0, fakefileno = UINT64_MAX; | ||||
u_int64_t fileno = 0; | u_int64_t fileno = 0; | ||||
char *cp; | char *cp; | ||||
nfsattrbit_t attrbits, dattrbits; | nfsattrbit_t attrbits, dattrbits; | ||||
size_t tresid; | size_t tresid; | ||||
u_int32_t *tl2 = NULL, rderr; | u_int32_t *tl2 = NULL, rderr; | ||||
struct timespec dctime; | struct timespec dctime, ts; | ||||
bool attr_ok; | |||||
KASSERT(uiop->uio_iovcnt == 1 && | KASSERT(uiop->uio_iovcnt == 1 && | ||||
(uiop->uio_resid & (DIRBLKSIZ - 1)) == 0, | (uiop->uio_resid & (DIRBLKSIZ - 1)) == 0, | ||||
("nfs readdirplusrpc bad uio")); | ("nfs readdirplusrpc bad uio")); | ||||
ncookie.lval[0] = ncookie.lval[1] = 0; | ncookie.lval[0] = ncookie.lval[1] = 0; | ||||
timespecclear(&dctime); | timespecclear(&dctime); | ||||
*attrflagp = 0; | *attrflagp = 0; | ||||
if (eofp != NULL) | if (eofp != NULL) | ||||
▲ Show 20 Lines • Show All 168 Lines • ▼ Show 20 Lines | while (more_dirs && bigenough) { | ||||
*tl++ = txdr_unsigned(nmp->nm_readdirsize); | *tl++ = txdr_unsigned(nmp->nm_readdirsize); | ||||
*tl = txdr_unsigned(nmp->nm_readdirsize); | *tl = txdr_unsigned(nmp->nm_readdirsize); | ||||
if (nd->nd_flag & ND_NFSV4) { | if (nd->nd_flag & ND_NFSV4) { | ||||
(void) nfsrv_putattrbit(nd, &attrbits); | (void) nfsrv_putattrbit(nd, &attrbits); | ||||
NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); | NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); | ||||
*tl = txdr_unsigned(NFSV4OP_GETATTR); | *tl = txdr_unsigned(NFSV4OP_GETATTR); | ||||
(void) nfsrv_putattrbit(nd, &dattrbits); | (void) nfsrv_putattrbit(nd, &dattrbits); | ||||
} | } | ||||
nanouptime(&ts); | |||||
error = nfscl_request(nd, vp, p, cred, stuff); | error = nfscl_request(nd, vp, p, cred, stuff); | ||||
if (error) | if (error) | ||||
return (error); | return (error); | ||||
if (nd->nd_flag & ND_NFSV3) | if (nd->nd_flag & ND_NFSV3) | ||||
error = nfscl_postop_attr(nd, nap, attrflagp, stuff); | error = nfscl_postop_attr(nd, nap, attrflagp, stuff); | ||||
if (nd->nd_repstat || error) { | if (nd->nd_repstat || error) { | ||||
if (!error) | if (!error) | ||||
error = nd->nd_repstat; | error = nd->nd_repstat; | ||||
▲ Show 20 Lines • Show All 141 Lines • ▼ Show 20 Lines | while (more_dirs && bigenough) { | ||||
dp->d_fileno = fileno; | dp->d_fileno = fileno; | ||||
} | } | ||||
*tl2++ = cookiep->nfsuquad[0] = cookie.lval[0] = | *tl2++ = cookiep->nfsuquad[0] = cookie.lval[0] = | ||||
ncookie.lval[0]; | ncookie.lval[0]; | ||||
*tl2 = cookiep->nfsuquad[1] = cookie.lval[1] = | *tl2 = cookiep->nfsuquad[1] = cookie.lval[1] = | ||||
ncookie.lval[1]; | ncookie.lval[1]; | ||||
if (nfhp != NULL) { | if (nfhp != NULL) { | ||||
attr_ok = true; | |||||
if (NFSRV_CMPFH(nfhp->nfh_fh, nfhp->nfh_len, | if (NFSRV_CMPFH(nfhp->nfh_fh, nfhp->nfh_len, | ||||
dnp->n_fhp->nfh_fh, dnp->n_fhp->nfh_len)) { | dnp->n_fhp->nfh_fh, dnp->n_fhp->nfh_len)) { | ||||
VREF(vp); | VREF(vp); | ||||
newvp = vp; | newvp = vp; | ||||
unlocknewvp = 0; | unlocknewvp = 0; | ||||
free(nfhp, M_NFSFH); | free(nfhp, M_NFSFH); | ||||
np = dnp; | np = dnp; | ||||
} else if (isdotdot != 0) { | } else if (isdotdot != 0) { | ||||
Show All 13 Lines | while (more_dirs && bigenough) { | ||||
*/ | */ | ||||
free(nfhp, M_NFSFH); | free(nfhp, M_NFSFH); | ||||
} else { | } else { | ||||
error = nfscl_nget(vp->v_mount, vp, | error = nfscl_nget(vp->v_mount, vp, | ||||
nfhp, cnp, p, &np, NULL, LK_EXCLUSIVE); | nfhp, cnp, p, &np, NULL, LK_EXCLUSIVE); | ||||
if (!error) { | if (!error) { | ||||
newvp = NFSTOV(np); | newvp = NFSTOV(np); | ||||
unlocknewvp = 1; | unlocknewvp = 1; | ||||
/* | |||||
* If n_localmodtime >= time before RPC, | |||||
* then a file modification operation, | |||||
* such as VOP_SETATTR() of size, has | |||||
* ocuurred while the Lookup RPC and | |||||
* acquisition of the vnode happened. As | |||||
* such, the attributes might be stale, | |||||
* with possibly an incorrect size. | |||||
*/ | |||||
NFSLOCKNODE(np); | |||||
if (timespecisset( | |||||
&np->n_localmodtime) && | |||||
timespeccmp(&np->n_localmodtime, | |||||
&ts, >=)) { | |||||
NFSCL_DEBUG(4, "nfsrpc_readdirplus:" | |||||
" localmod stale attributes\n"); | |||||
attr_ok = false; | |||||
} | } | ||||
NFSUNLOCKNODE(np); | |||||
} | } | ||||
} | |||||
nfhp = NULL; | nfhp = NULL; | ||||
if (newvp != NULLVP) { | if (newvp != NULLVP) { | ||||
if (attr_ok) | |||||
error = nfscl_loadattrcache(&newvp, | error = nfscl_loadattrcache(&newvp, | ||||
&nfsva, NULL, NULL, 0, 0); | &nfsva, NULL, NULL, 0, 0); | ||||
if (error) { | if (error) { | ||||
if (unlocknewvp) | if (unlocknewvp) | ||||
vput(newvp); | vput(newvp); | ||||
else | else | ||||
vrele(newvp); | vrele(newvp); | ||||
goto nfsmout; | goto nfsmout; | ||||
} | } | ||||
dp->d_type = | dp->d_type = | ||||
▲ Show 20 Lines • Show All 5,022 Lines • Show Last 20 Lines |