View | Details | Raw Unified | Return to bug 260011 | Differences between
and this patch

Collapse All | Expand All

(-)sys/fs/nfs/nfscl.h (-2 / +2 lines)
Lines 49-58 struct nfsv4node { Link Here
49
/*
49
/*
50
 * Just a macro to convert the nfscl_reqstart arguments.
50
 * Just a macro to convert the nfscl_reqstart arguments.
51
 */
51
 */
52
#define	NFSCL_REQSTART(n, p, v) 					\
52
#define	NFSCL_REQSTART(n, p, v, c) 					\
53
	nfscl_reqstart((n), (p), VFSTONFS((v)->v_mount), 		\
53
	nfscl_reqstart((n), (p), VFSTONFS((v)->v_mount), 		\
54
	    VTONFS(v)->n_fhp->nfh_fh, VTONFS(v)->n_fhp->nfh_len, NULL,	\
54
	    VTONFS(v)->n_fhp->nfh_fh, VTONFS(v)->n_fhp->nfh_len, NULL,	\
55
	    NULL, 0, 0)
55
	    NULL, 0, 0, (c))
56
56
57
/*
57
/*
58
 * These two macros convert between a lease duration and renew interval.
58
 * These two macros convert between a lease duration and renew interval.
(-)sys/fs/nfs/nfsclstate.h (+1 lines)
Lines 67-72 struct nfsclsession { Link Here
67
	SVCXPRT		*nfsess_xprt;		/* For backchannel callback */
67
	SVCXPRT		*nfsess_xprt;		/* For backchannel callback */
68
	uint32_t	nfsess_slotseq[64];	/* Max for 64bit nm_slots */
68
	uint32_t	nfsess_slotseq[64];	/* Max for 64bit nm_slots */
69
	uint64_t	nfsess_slots;
69
	uint64_t	nfsess_slots;
70
	uint64_t	nfsess_badslots;	/* Slots possibly broken */
70
	uint32_t	nfsess_sequenceid;
71
	uint32_t	nfsess_sequenceid;
71
	uint32_t	nfsess_maxcache;	/* Max size for cached reply. */
72
	uint32_t	nfsess_maxcache;	/* Max size for cached reply. */
72
	uint32_t	nfsess_maxreq;		/* Max request size. */
73
	uint32_t	nfsess_maxreq;		/* Max request size. */
(-)sys/fs/nfs/nfs_commonsubs.c (-16 / +84 lines)
Lines 323-329 static int nfs_bigrequest[NFSV42_NPROCS] = { Link Here
323
void
323
void
324
nfscl_reqstart(struct nfsrv_descript *nd, int procnum, struct nfsmount *nmp,
324
nfscl_reqstart(struct nfsrv_descript *nd, int procnum, struct nfsmount *nmp,
325
    u_int8_t *nfhp, int fhlen, u_int32_t **opcntpp, struct nfsclsession *sep,
325
    u_int8_t *nfhp, int fhlen, u_int32_t **opcntpp, struct nfsclsession *sep,
326
    int vers, int minorvers)
326
    int vers, int minorvers, struct ucred *cred)
327
{
327
{
328
	struct mbuf *mb;
328
	struct mbuf *mb;
329
	u_int32_t *tl;
329
	u_int32_t *tl;
Lines 416-426 nfscl_reqstart(struct nfsrv_descript *nd, int procnum, Link Here
416
			*tl = txdr_unsigned(NFSV4OP_SEQUENCE);
416
			*tl = txdr_unsigned(NFSV4OP_SEQUENCE);
417
			if (sep == NULL) {
417
			if (sep == NULL) {
418
				sep = nfsmnt_mdssession(nmp);
418
				sep = nfsmnt_mdssession(nmp);
419
				/*
420
				 * For MDS mount sessions, check for bad
421
				 * slots.  If the caller does not want this
422
				 * check to be done, the "cred" argument can
423
				 * be passed in as NULL.
424
				 */
419
				nfsv4_setsequence(nmp, nd, sep,
425
				nfsv4_setsequence(nmp, nd, sep,
420
				    nfs_bigreply[procnum]);
426
				    nfs_bigreply[procnum], cred);
421
			} else
427
			} else
422
				nfsv4_setsequence(nmp, nd, sep,
428
				nfsv4_setsequence(nmp, nd, sep,
423
				    nfs_bigreply[procnum]);
429
				    nfs_bigreply[procnum], NULL);
424
		}
430
		}
425
		if (nfsv4_opflag[nfsv4_opmap[procnum].op].needscfh > 0) {
431
		if (nfsv4_opflag[nfsv4_opmap[procnum].op].needscfh > 0) {
426
			NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
432
			NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
Lines 4773-4786 nfsv4_seqsess_cacherep(uint32_t slotid, struct nfsslot Link Here
4773
 */
4779
 */
4774
void
4780
void
4775
nfsv4_setsequence(struct nfsmount *nmp, struct nfsrv_descript *nd,
4781
nfsv4_setsequence(struct nfsmount *nmp, struct nfsrv_descript *nd,
4776
    struct nfsclsession *sep, int dont_replycache)
4782
    struct nfsclsession *sep, int dont_replycache, struct ucred *cred)
4777
{
4783
{
4778
	uint32_t *tl, slotseq = 0;
4784
	uint32_t *tl, slotseq = 0;
4779
	int error, maxslot, slotpos;
4785
	int error, maxslot, slotpos;
4780
	uint8_t sessionid[NFSX_V4SESSIONID];
4786
	uint8_t sessionid[NFSX_V4SESSIONID];
4781
4787
4782
	error = nfsv4_sequencelookup(nmp, sep, &slotpos, &maxslot, &slotseq,
4788
	if (cred != NULL) {
4783
	    sessionid);
4789
		error = nfsv4_sequencelookup(nmp, sep, &slotpos, &maxslot,
4790
		    &slotseq, sessionid, false);
4791
		if (error == NFSERR_SEQMISORDERED) {
4792
			/* If all slots are bad, Destroy the session. */
4793
			nfsrpc_destroysession(nmp, sep, cred, curthread);
4794
			error = 0;
4795
		}
4796
	} else
4797
		error = nfsv4_sequencelookup(nmp, sep, &slotpos, &maxslot,
4798
		    &slotseq, sessionid, true);
4784
	nd->nd_maxreq = sep->nfsess_maxreq;
4799
	nd->nd_maxreq = sep->nfsess_maxreq;
4785
	nd->nd_maxresp = sep->nfsess_maxresp;
4800
	nd->nd_maxresp = sep->nfsess_maxresp;
4786
4801
Lines 4817-4833 nfsv4_setsequence(struct nfsmount *nmp, struct nfsrv_d Link Here
4817
	nd->nd_flag |= ND_HASSEQUENCE;
4832
	nd->nd_flag |= ND_HASSEQUENCE;
4818
}
4833
}
4819
4834
4835
/*
4836
 * If fnd_init is true, ignore the badslots.
4837
 * If fnd_init is false, return NFSERR_SEQMISORDERED of all slots are bad.
4838
 */
4820
int
4839
int
4821
nfsv4_sequencelookup(struct nfsmount *nmp, struct nfsclsession *sep,
4840
nfsv4_sequencelookup(struct nfsmount *nmp, struct nfsclsession *sep,
4822
    int *slotposp, int *maxslotp, uint32_t *slotseqp, uint8_t *sessionid)
4841
    int *slotposp, int *maxslotp, uint32_t *slotseqp, uint8_t *sessionid,
4842
    bool fnd_init)
4823
{
4843
{
4824
	int i, maxslot, slotpos;
4844
	int i, maxslot, slotpos;
4825
	uint64_t bitval;
4845
	uint64_t bitval;
4846
	bool fnd_ok;
4826
4847
4827
	/* Find an unused slot. */
4848
	/* Find an unused slot. */
4828
	slotpos = -1;
4849
	slotpos = -1;
4829
	maxslot = -1;
4850
	maxslot = -1;
4830
	mtx_lock(&sep->nfsess_mtx);
4851
	mtx_lock(&sep->nfsess_mtx);
4852
if (sep->nfsess_badslots != 0) printf("bad slots=0x%lx\n", sep->nfsess_badslots);
4831
	do {
4853
	do {
4832
		if (nmp != NULL && sep->nfsess_defunct != 0) {
4854
		if (nmp != NULL && sep->nfsess_defunct != 0) {
4833
			/* Just return the bad session. */
4855
			/* Just return the bad session. */
Lines 4836-4849 nfsv4_sequencelookup(struct nfsmount *nmp, struct nfsc Link Here
4836
			mtx_unlock(&sep->nfsess_mtx);
4858
			mtx_unlock(&sep->nfsess_mtx);
4837
			return (NFSERR_BADSESSION);
4859
			return (NFSERR_BADSESSION);
4838
		}
4860
		}
4861
		fnd_ok = fnd_init;
4839
		bitval = 1;
4862
		bitval = 1;
4840
		for (i = 0; i < sep->nfsess_foreslots; i++) {
4863
		for (i = 0; i < sep->nfsess_foreslots; i++) {
4841
			if ((bitval & sep->nfsess_slots) == 0) {
4864
			if ((bitval & sep->nfsess_badslots) == 0 || fnd_init) {
4842
				slotpos = i;
4865
				fnd_ok = true;
4843
				sep->nfsess_slots |= bitval;
4866
				if ((bitval & sep->nfsess_slots) == 0) {
4844
				sep->nfsess_slotseq[i]++;
4867
					slotpos = i;
4845
				*slotseqp = sep->nfsess_slotseq[i];
4868
					sep->nfsess_slots |= bitval;
4846
				break;
4869
					sep->nfsess_slotseq[i]++;
4870
					*slotseqp = sep->nfsess_slotseq[i];
4871
					break;
4872
				}
4847
			}
4873
			}
4848
			bitval <<= 1;
4874
			bitval <<= 1;
4849
		}
4875
		}
Lines 4858-4867 nfsv4_sequencelookup(struct nfsmount *nmp, struct nfsc Link Here
4858
				return (ESTALE);
4884
				return (ESTALE);
4859
			}
4885
			}
4860
			/* Wake up once/sec, to check for a forced dismount. */
4886
			/* Wake up once/sec, to check for a forced dismount. */
4861
			(void)mtx_sleep(&sep->nfsess_slots, &sep->nfsess_mtx,
4887
			if (fnd_ok)
4862
			    PZERO, "nfsclseq", hz);
4888
				mtx_sleep(&sep->nfsess_slots, &sep->nfsess_mtx,
4889
				    PZERO, "nfsclseq", hz);
4863
		}
4890
		}
4864
	} while (slotpos == -1);
4891
	} while (slotpos == -1 && fnd_ok);
4892
	/*
4893
	 * If all slots are bad, just return slot 0 and NFSERR_SEQMISORDERED.
4894
	 * The caller will do a DestroySession, so that the session's use
4895
	 * will get a NFSERR_BADSESSION reply from the server.
4896
	 */
4897
	if (!fnd_ok)
4898
		slotpos = 0;
4899
4865
	/* Now, find the highest slot in use. (nfsc_slots is 64bits) */
4900
	/* Now, find the highest slot in use. (nfsc_slots is 64bits) */
4866
	bitval = 1;
4901
	bitval = 1;
4867
	for (i = 0; i < 64; i++) {
4902
	for (i = 0; i < 64; i++) {
Lines 4873-4878 nfsv4_sequencelookup(struct nfsmount *nmp, struct nfsc Link Here
4873
	mtx_unlock(&sep->nfsess_mtx);
4908
	mtx_unlock(&sep->nfsess_mtx);
4874
	*slotposp = slotpos;
4909
	*slotposp = slotpos;
4875
	*maxslotp = maxslot;
4910
	*maxslotp = maxslot;
4911
4912
	if (!fnd_ok)
4913
{ printf("ret seqmis\n");
4914
		return (NFSERR_SEQMISORDERED);
4915
}
4876
	return (0);
4916
	return (0);
4877
}
4917
}
4878
4918
Lines 4988-4991 nfsm_add_ext_pgs(struct mbuf *m, int maxextsiz, int *b Link Here
4988
		mp = m;
5028
		mp = m;
4989
	}
5029
	}
4990
	return (mp);
5030
	return (mp);
5031
}
5032
5033
/*
5034
 * Do the NFSv4.1 Destroy Session.
5035
 */
5036
int
5037
nfsrpc_destroysession(struct nfsmount *nmp, struct nfsclsession *tsep,
5038
    struct ucred *cred, NFSPROC_T *p)
5039
{
5040
	uint32_t *tl;
5041
	struct nfsrv_descript nfsd;
5042
	struct nfsrv_descript *nd = &nfsd;
5043
	int error;
5044
5045
	nfscl_reqstart(nd, NFSPROC_DESTROYSESSION, nmp, NULL, 0, NULL, NULL, 0,
5046
	    0, NULL);
5047
	NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID);
5048
	if (tsep == NULL)
5049
		tsep = nfsmnt_mdssession(nmp);
5050
	bcopy(tsep->nfsess_sessionid, tl, NFSX_V4SESSIONID);
5051
	nd->nd_flag |= ND_USEGSSNAME;
5052
	error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, NULL, p, cred,
5053
	    NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL);
5054
	if (error != 0)
5055
		return (error);
5056
	error = nd->nd_repstat;
5057
	m_freem(nd->nd_mrep);
5058
	return (error);
4991
}
5059
}
(-)sys/fs/nfs/nfs_var.h (-4 / +5 lines)
Lines 317-323 void nfsrc_trimcache(uint64_t, uint32_t, int); Link Here
317
317
318
/* nfs_commonsubs.c */
318
/* nfs_commonsubs.c */
319
void nfscl_reqstart(struct nfsrv_descript *, int, struct nfsmount *,
319
void nfscl_reqstart(struct nfsrv_descript *, int, struct nfsmount *,
320
    u_int8_t *, int, u_int32_t **, struct nfsclsession *, int, int);
320
    u_int8_t *, int, u_int32_t **, struct nfsclsession *, int, int,
321
    struct ucred *);
321
void nfsm_stateidtom(struct nfsrv_descript *, nfsv4stateid_t *, int);
322
void nfsm_stateidtom(struct nfsrv_descript *, nfsv4stateid_t *, int);
322
void nfscl_fillsattr(struct nfsrv_descript *, struct vattr *,
323
void nfscl_fillsattr(struct nfsrv_descript *, struct vattr *,
323
      vnode_t, int, u_int32_t);
324
      vnode_t, int, u_int32_t);
Lines 357-365 int nfsv4_seqsession(uint32_t, uint32_t, uint32_t, str Link Here
357
    struct mbuf **, uint16_t);
358
    struct mbuf **, uint16_t);
358
void nfsv4_seqsess_cacherep(uint32_t, struct nfsslot *, int, struct mbuf **);
359
void nfsv4_seqsess_cacherep(uint32_t, struct nfsslot *, int, struct mbuf **);
359
void nfsv4_setsequence(struct nfsmount *, struct nfsrv_descript *,
360
void nfsv4_setsequence(struct nfsmount *, struct nfsrv_descript *,
360
    struct nfsclsession *, int);
361
    struct nfsclsession *, int, struct ucred *);
361
int nfsv4_sequencelookup(struct nfsmount *, struct nfsclsession *, int *,
362
int nfsv4_sequencelookup(struct nfsmount *, struct nfsclsession *, int *,
362
    int *, uint32_t *, uint8_t *);
363
    int *, uint32_t *, uint8_t *, bool);
363
void nfsv4_freeslot(struct nfsclsession *, int, bool);
364
void nfsv4_freeslot(struct nfsclsession *, int, bool);
364
struct ucred *nfsrv_getgrpscred(struct ucred *);
365
struct ucred *nfsrv_getgrpscred(struct ucred *);
365
struct nfsdevice *nfsv4_findmirror(struct nfsmount *);
366
struct nfsdevice *nfsv4_findmirror(struct nfsmount *);
Lines 530-536 int nfsrpc_exchangeid(struct nfsmount *, struct nfsclc Link Here
530
int nfsrpc_createsession(struct nfsmount *, struct nfsclsession *,
531
int nfsrpc_createsession(struct nfsmount *, struct nfsclsession *,
531
    struct nfssockreq *, struct nfsclds *, uint32_t, int, struct ucred *,
532
    struct nfssockreq *, struct nfsclds *, uint32_t, int, struct ucred *,
532
    NFSPROC_T *);
533
    NFSPROC_T *);
533
int nfsrpc_destroysession(struct nfsmount *, struct nfsclclient *,
534
int nfsrpc_destroysession(struct nfsmount *, struct nfsclsession *,
534
    struct ucred *, NFSPROC_T *);
535
    struct ucred *, NFSPROC_T *);
535
int nfsrpc_destroyclient(struct nfsmount *, struct nfsclclient *,
536
int nfsrpc_destroyclient(struct nfsmount *, struct nfsclclient *,
536
    struct ucred *, NFSPROC_T *);
537
    struct ucred *, NFSPROC_T *);
(-)sys/fs/nfs/nfs_commonkrpc.c (-5 / +38 lines)
Lines 951-956 tryagain: Link Here
951
			 */
951
			 */
952
			mtx_lock(&sep->nfsess_mtx);
952
			mtx_lock(&sep->nfsess_mtx);
953
			sep->nfsess_slotseq[nd->nd_slotid] += 10;
953
			sep->nfsess_slotseq[nd->nd_slotid] += 10;
954
			sep->nfsess_badslots |= (0x1ULL << nd->nd_slotid);
954
			mtx_unlock(&sep->nfsess_mtx);
955
			mtx_unlock(&sep->nfsess_mtx);
955
			/* And free the slot. */
956
			/* And free the slot. */
956
			nfsv4_freeslot(sep, nd->nd_slotid, false);
957
			nfsv4_freeslot(sep, nd->nd_slotid, false);
Lines 1019-1026 tryagain: Link Here
1019
			 * If the first op is Sequence, free up the slot.
1020
			 * If the first op is Sequence, free up the slot.
1020
			 */
1021
			 */
1021
			if ((nmp != NULL && i == NFSV4OP_SEQUENCE && j != 0) ||
1022
			if ((nmp != NULL && i == NFSV4OP_SEQUENCE && j != 0) ||
1022
			    (clp != NULL && i == NFSV4OP_CBSEQUENCE && j != 0))
1023
			   (clp != NULL && i == NFSV4OP_CBSEQUENCE && j != 0)) {
1023
				NFSCL_DEBUG(1, "failed seq=%d\n", j);
1024
				NFSCL_DEBUG(1, "failed seq=%d\n", j);
1025
				if (sep != NULL && i == NFSV4OP_SEQUENCE &&
1026
				    j == NFSERR_SEQMISORDERED) {
1027
					mtx_lock(&sep->nfsess_mtx);
1028
					sep->nfsess_badslots |=
1029
					    (0x1ULL << nd->nd_slotid);
1030
					mtx_unlock(&sep->nfsess_mtx);
1031
				}
1032
			}
1024
			if (((nmp != NULL && i == NFSV4OP_SEQUENCE && j == 0) ||
1033
			if (((nmp != NULL && i == NFSV4OP_SEQUENCE && j == 0) ||
1025
			    (clp != NULL && i == NFSV4OP_CBSEQUENCE &&
1034
			    (clp != NULL && i == NFSV4OP_CBSEQUENCE &&
1026
			    j == 0)) && sep != NULL) {
1035
			    j == 0)) && sep != NULL) {
Lines 1039-1049 tryagain: Link Here
1039
					retseq = fxdr_unsigned(uint32_t, *tl++);
1048
					retseq = fxdr_unsigned(uint32_t, *tl++);
1040
					slot = fxdr_unsigned(int, *tl++);
1049
					slot = fxdr_unsigned(int, *tl++);
1041
					if ((nd->nd_flag & ND_HASSLOTID) != 0) {
1050
					if ((nd->nd_flag & ND_HASSLOTID) != 0) {
1042
						if (slot != nd->nd_slotid) {
1051
						if (slot >= NFSV4_SLOTS ||
1052
						    (i == NFSV4OP_CBSEQUENCE &&
1053
						     slot >= NFSV4_CBSLOTS)) {
1043
							printf("newnfs_request:"
1054
							printf("newnfs_request:"
1044
							    " Wrong session "
1055
							    " Bogus slot\n");
1045
							    "slot=%d\n", slot);
1046
							slot = nd->nd_slotid;
1056
							slot = nd->nd_slotid;
1057
						} else if (slot !=
1058
						    nd->nd_slotid) {
1059
						    printf("newnfs_request:"
1060
							" Wrong session "
1061
							"srvslot=%d "
1062
							"slot=%d\n", slot,
1063
							nd->nd_slotid);
1064
						    if (i == NFSV4OP_SEQUENCE) {
1065
							/*
1066
							 * Mark both slots as
1067
							 * bad, because we do
1068
							 * not know if the
1069
							 * server has advanced
1070
							 * the sequence# for
1071
							 * either of them.
1072
							 */
1073
							sep->nfsess_badslots |=
1074
							    (0x1ULL << slot);
1075
							sep->nfsess_badslots |=
1076
							    (0x1ULL <<
1077
							     nd->nd_slotid);
1078
						    }
1079
						    slot = nd->nd_slotid;
1047
						}
1080
						}
1048
					} else if (slot != 0) {
1081
					} else if (slot != 0) {
1049
						printf("newnfs_request: Bad "
1082
						printf("newnfs_request: Bad "
Lines 1122-1128 printf("nfs_commonkrpc: initiate recovery\n"); Link Here
1122
				if ((nd->nd_flag & ND_LOOPBADSESS) != 0) {
1155
				if ((nd->nd_flag & ND_LOOPBADSESS) != 0) {
1123
					reterr = nfsv4_sequencelookup(nmp, sep,
1156
					reterr = nfsv4_sequencelookup(nmp, sep,
1124
					    &slotpos, &maxslot, &slotseq,
1157
					    &slotpos, &maxslot, &slotseq,
1125
					    sessionid);
1158
					    sessionid, true);
1126
					if (reterr == 0) {
1159
					if (reterr == 0) {
1127
						/* Fill in new session info. */
1160
						/* Fill in new session info. */
1128
						NFSCL_DEBUG(1,
1161
						NFSCL_DEBUG(1,
(-)sys/fs/nfsclient/nfs_clrpcops.c (-112 / +101 lines)
Lines 241-247 nfsrpc_null(vnode_t vp, struct ucred *cred, NFSPROC_T Link Here
241
	int error;
241
	int error;
242
	struct nfsrv_descript nfsd, *nd = &nfsd;
242
	struct nfsrv_descript nfsd, *nd = &nfsd;
243
243
244
	NFSCL_REQSTART(nd, NFSPROC_NULL, vp);
244
	NFSCL_REQSTART(nd, NFSPROC_NULL, vp, NULL);
245
	error = nfscl_request(nd, vp, p, cred);
245
	error = nfscl_request(nd, vp, p, cred);
246
	if (nd->nd_repstat && !error)
246
	if (nd->nd_repstat && !error)
247
		error = nd->nd_repstat;
247
		error = nd->nd_repstat;
Lines 310-316 nfsrpc_accessrpc(vnode_t vp, u_int32_t mode, struct uc Link Here
310
310
311
	*attrflagp = 0;
311
	*attrflagp = 0;
312
	supported = mode;
312
	supported = mode;
313
	NFSCL_REQSTART(nd, NFSPROC_ACCESS, vp);
313
	NFSCL_REQSTART(nd, NFSPROC_ACCESS, vp, cred);
314
	NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
314
	NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
315
	*tl = txdr_unsigned(mode);
315
	*tl = txdr_unsigned(mode);
316
	if (nd->nd_flag & ND_NFSV4) {
316
	if (nd->nd_flag & ND_NFSV4) {
Lines 514-520 nfsrpc_openrpc(struct nfsmount *nmp, vnode_t vp, u_int Link Here
514
514
515
	dp = *dpp;
515
	dp = *dpp;
516
	*dpp = NULL;
516
	*dpp = NULL;
517
	nfscl_reqstart(nd, NFSPROC_OPEN, nmp, nfhp, fhlen, NULL, NULL, 0, 0);
517
	nfscl_reqstart(nd, NFSPROC_OPEN, nmp, nfhp, fhlen, NULL, NULL, 0, 0,
518
	    cred);
518
	NFSM_BUILD(tl, u_int32_t *, 5 * NFSX_UNSIGNED);
519
	NFSM_BUILD(tl, u_int32_t *, 5 * NFSX_UNSIGNED);
519
	*tl++ = txdr_unsigned(op->nfso_own->nfsow_seqid);
520
	*tl++ = txdr_unsigned(op->nfso_own->nfsow_seqid);
520
	*tl++ = txdr_unsigned(mode & NFSV4OPEN_ACCESSBOTH);
521
	*tl++ = txdr_unsigned(mode & NFSV4OPEN_ACCESSBOTH);
Lines 707-713 nfsrpc_opendowngrade(vnode_t vp, u_int32_t mode, struc Link Here
707
	struct nfsrv_descript nfsd, *nd = &nfsd;
708
	struct nfsrv_descript nfsd, *nd = &nfsd;
708
	int error;
709
	int error;
709
710
710
	NFSCL_REQSTART(nd, NFSPROC_OPENDOWNGRADE, vp);
711
	NFSCL_REQSTART(nd, NFSPROC_OPENDOWNGRADE, vp, cred);
711
	NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID + 3 * NFSX_UNSIGNED);
712
	NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID + 3 * NFSX_UNSIGNED);
712
	if (NFSHASNFSV4N(VFSTONFS(vp->v_mount)))
713
	if (NFSHASNFSV4N(VFSTONFS(vp->v_mount)))
713
		*tl++ = 0;
714
		*tl++ = 0;
Lines 872-878 nfsrpc_closerpc(struct nfsrv_descript *nd, struct nfsm Link Here
872
	int error;
873
	int error;
873
874
874
	nfscl_reqstart(nd, NFSPROC_CLOSE, nmp, op->nfso_fh,
875
	nfscl_reqstart(nd, NFSPROC_CLOSE, nmp, op->nfso_fh,
875
	    op->nfso_fhlen, NULL, NULL, 0, 0);
876
	    op->nfso_fhlen, NULL, NULL, 0, 0, cred);
876
	NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED + NFSX_STATEID);
877
	NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED + NFSX_STATEID);
877
	if (NFSHASNFSV4N(nmp)) {
878
	if (NFSHASNFSV4N(nmp)) {
878
		*tl++ = 0;
879
		*tl++ = 0;
Lines 918-924 nfsrpc_openconfirm(vnode_t vp, u_int8_t *nfhp, int fhl Link Here
918
	if (NFSHASNFSV4N(nmp))
919
	if (NFSHASNFSV4N(nmp))
919
		return (0);		/* No confirmation for NFSv4.1. */
920
		return (0);		/* No confirmation for NFSv4.1. */
920
	nfscl_reqstart(nd, NFSPROC_OPENCONFIRM, nmp, nfhp, fhlen, NULL, NULL,
921
	nfscl_reqstart(nd, NFSPROC_OPENCONFIRM, nmp, nfhp, fhlen, NULL, NULL,
921
	    0, 0);
922
	    0, 0, NULL);
922
	NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED + NFSX_STATEID);
923
	NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED + NFSX_STATEID);
923
	*tl++ = op->nfso_stateid.seqid;
924
	*tl++ = op->nfso_stateid.seqid;
924
	*tl++ = op->nfso_stateid.other[0];
925
	*tl++ = op->nfso_stateid.other[0];
Lines 1062-1069 nfsrpc_setclient(struct nfsmount *nmp, struct nfsclcli Link Here
1062
			 * in-progress RPCs.
1063
			 * in-progress RPCs.
1063
			 */
1064
			 */
1064
			tsep = NULL;
1065
			tsep = NULL;
1065
			if (TAILQ_FIRST(&nmp->nm_sess) != NULL)
1066
			if (TAILQ_FIRST(&nmp->nm_sess) != NULL) {
1066
				tsep = NFSMNT_MDSSESSION(nmp);
1067
				tsep = NFSMNT_MDSSESSION(nmp);
1068
				if (tsep->nfsess_defunct == 0)
1069
					printf("nfsrpc_setclient: "
1070
					    "nfsess_defunct not set\n");
1071
			}
1067
			TAILQ_INSERT_HEAD(&nmp->nm_sess, dsp,
1072
			TAILQ_INSERT_HEAD(&nmp->nm_sess, dsp,
1068
			    nfsclds_list);
1073
			    nfsclds_list);
1069
			/*
1074
			/*
Lines 1105-1111 nfsrpc_setclient(struct nfsmount *nmp, struct nfsclcli Link Here
1105
	tsep = NFSMNT_MDSSESSION(nmp);
1110
	tsep = NFSMNT_MDSSESSION(nmp);
1106
	NFSUNLOCKMNT(nmp);
1111
	NFSUNLOCKMNT(nmp);
1107
1112
1108
	nfscl_reqstart(nd, NFSPROC_SETCLIENTID, nmp, NULL, 0, NULL, NULL, 0, 0);
1113
	nfscl_reqstart(nd, NFSPROC_SETCLIENTID, nmp, NULL, 0, NULL, NULL, 0, 0,
1114
	    NULL);
1109
	NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
1115
	NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
1110
	*tl++ = txdr_unsigned(nfsboottime.tv_sec);
1116
	*tl++ = txdr_unsigned(nfsboottime.tv_sec);
1111
	*tl = txdr_unsigned(clp->nfsc_rev);
1117
	*tl = txdr_unsigned(clp->nfsc_rev);
Lines 1175-1181 nfsrpc_setclient(struct nfsmount *nmp, struct nfsclcli Link Here
1175
	     * and confirm it.
1181
	     * and confirm it.
1176
	     */
1182
	     */
1177
	    nfscl_reqstart(nd, NFSPROC_SETCLIENTIDCFRM, nmp, NULL, 0, NULL,
1183
	    nfscl_reqstart(nd, NFSPROC_SETCLIENTIDCFRM, nmp, NULL, 0, NULL,
1178
		NULL, 0, 0);
1184
		NULL, 0, 0, NULL);
1179
	    NFSM_BUILD(tl, u_int32_t *, 4 * NFSX_UNSIGNED);
1185
	    NFSM_BUILD(tl, u_int32_t *, 4 * NFSX_UNSIGNED);
1180
	    *tl++ = tsep->nfsess_clientid.lval[0];
1186
	    *tl++ = tsep->nfsess_clientid.lval[0];
1181
	    *tl++ = tsep->nfsess_clientid.lval[1];
1187
	    *tl++ = tsep->nfsess_clientid.lval[1];
Lines 1206-1212 nfsrpc_getattr(vnode_t vp, struct ucred *cred, NFSPROC Link Here
1206
	int error;
1212
	int error;
1207
	nfsattrbit_t attrbits;
1213
	nfsattrbit_t attrbits;
1208
1214
1209
	NFSCL_REQSTART(nd, NFSPROC_GETATTR, vp);
1215
	NFSCL_REQSTART(nd, NFSPROC_GETATTR, vp, cred);
1210
	if (nd->nd_flag & ND_NFSV4) {
1216
	if (nd->nd_flag & ND_NFSV4) {
1211
		NFSGETATTR_ATTRBIT(&attrbits);
1217
		NFSGETATTR_ATTRBIT(&attrbits);
1212
		(void) nfsrv_putattrbit(nd, &attrbits);
1218
		(void) nfsrv_putattrbit(nd, &attrbits);
Lines 1234-1240 nfsrpc_getattrnovp(struct nfsmount *nmp, u_int8_t *fhp Link Here
1234
	int error, vers = NFS_VER2;
1240
	int error, vers = NFS_VER2;
1235
	nfsattrbit_t attrbits;
1241
	nfsattrbit_t attrbits;
1236
1242
1237
	nfscl_reqstart(nd, NFSPROC_GETATTR, nmp, fhp, fhlen, NULL, NULL, 0, 0);
1243
	nfscl_reqstart(nd, NFSPROC_GETATTR, nmp, fhp, fhlen, NULL, NULL, 0, 0,
1244
	    cred);
1238
	if (nd->nd_flag & ND_NFSV4) {
1245
	if (nd->nd_flag & ND_NFSV4) {
1239
		vers = NFS_VER4;
1246
		vers = NFS_VER4;
1240
		NFSGETATTR_ATTRBIT(&attrbits);
1247
		NFSGETATTR_ATTRBIT(&attrbits);
Lines 1359-1365 nfsrpc_setattrrpc(vnode_t vp, struct vattr *vap, Link Here
1359
	nfsattrbit_t attrbits;
1366
	nfsattrbit_t attrbits;
1360
1367
1361
	*attrflagp = 0;
1368
	*attrflagp = 0;
1362
	NFSCL_REQSTART(nd, NFSPROC_SETATTR, vp);
1369
	NFSCL_REQSTART(nd, NFSPROC_SETATTR, vp, cred);
1363
	if (nd->nd_flag & ND_NFSV4)
1370
	if (nd->nd_flag & ND_NFSV4)
1364
		nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSTATEID);
1371
		nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSTATEID);
1365
	vap->va_type = vnode_vtype(vp);
1372
	vap->va_type = vnode_vtype(vp);
Lines 1433-1444 nfsrpc_lookup(vnode_t dvp, char *name, int len, struct Link Here
1433
		name[0] == '.' && name[1] == '.') {
1440
		name[0] == '.' && name[1] == '.') {
1434
		lookupp = 1;
1441
		lookupp = 1;
1435
		openmode = 0;
1442
		openmode = 0;
1436
		NFSCL_REQSTART(nd, NFSPROC_LOOKUPP, dvp);
1443
		NFSCL_REQSTART(nd, NFSPROC_LOOKUPP, dvp, cred);
1437
	} else if (openmode != 0) {
1444
	} else if (openmode != 0) {
1438
		NFSCL_REQSTART(nd, NFSPROC_LOOKUPOPEN, dvp);
1445
		NFSCL_REQSTART(nd, NFSPROC_LOOKUPOPEN, dvp, cred);
1439
		nfsm_strtom(nd, name, len);
1446
		nfsm_strtom(nd, name, len);
1440
	} else {
1447
	} else {
1441
		NFSCL_REQSTART(nd, NFSPROC_LOOKUP, dvp);
1448
		NFSCL_REQSTART(nd, NFSPROC_LOOKUP, dvp, cred);
1442
		(void) nfsm_strtom(nd, name, len);
1449
		(void) nfsm_strtom(nd, name, len);
1443
	}
1450
	}
1444
	if (nd->nd_flag & ND_NFSV4) {
1451
	if (nd->nd_flag & ND_NFSV4) {
Lines 1643-1649 nfsrpc_readlink(vnode_t vp, struct uio *uiop, struct u Link Here
1643
	int error, len, cangetattr = 1;
1650
	int error, len, cangetattr = 1;
1644
1651
1645
	*attrflagp = 0;
1652
	*attrflagp = 0;
1646
	NFSCL_REQSTART(nd, NFSPROC_READLINK, vp);
1653
	NFSCL_REQSTART(nd, NFSPROC_READLINK, vp, cred);
1647
	if (nd->nd_flag & ND_NFSV4) {
1654
	if (nd->nd_flag & ND_NFSV4) {
1648
		/*
1655
		/*
1649
		 * And do a Getattr op.
1656
		 * And do a Getattr op.
Lines 1779-1785 nfsrpc_readrpc(vnode_t vp, struct uio *uiop, struct uc Link Here
1779
	while (tsiz > 0) {
1786
	while (tsiz > 0) {
1780
		*attrflagp = 0;
1787
		*attrflagp = 0;
1781
		len = (tsiz > rsize) ? rsize : tsiz;
1788
		len = (tsiz > rsize) ? rsize : tsiz;
1782
		NFSCL_REQSTART(nd, NFSPROC_READ, vp);
1789
		NFSCL_REQSTART(nd, NFSPROC_READ, vp, cred);
1783
		if (nd->nd_flag & ND_NFSV4)
1790
		if (nd->nd_flag & ND_NFSV4)
1784
			nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSTATEID);
1791
			nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSTATEID);
1785
		NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED * 3);
1792
		NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED * 3);
Lines 1963-1971 nfsrpc_writerpc(vnode_t vp, struct uio *uiop, int *iom Link Here
1963
		*attrflagp = 0;
1970
		*attrflagp = 0;
1964
		len = (tsiz > wsize) ? wsize : tsiz;
1971
		len = (tsiz > wsize) ? wsize : tsiz;
1965
		if (do_append)
1972
		if (do_append)
1966
			NFSCL_REQSTART(nd, NFSPROC_APPENDWRITE, vp);
1973
			NFSCL_REQSTART(nd, NFSPROC_APPENDWRITE, vp, cred);
1967
		else
1974
		else
1968
			NFSCL_REQSTART(nd, NFSPROC_WRITE, vp);
1975
			NFSCL_REQSTART(nd, NFSPROC_WRITE, vp, cred);
1969
		if (nd->nd_flag & ND_NFSV4) {
1976
		if (nd->nd_flag & ND_NFSV4) {
1970
			if (do_append) {
1977
			if (do_append) {
1971
				NFSZERO_ATTRBIT(&attrbits);
1978
				NFSZERO_ATTRBIT(&attrbits);
Lines 2227-2233 nfsrpc_deallocaterpc(vnode_t vp, off_t offs, off_t len Link Here
2227
	nfsattrbit_t attrbits;
2234
	nfsattrbit_t attrbits;
2228
2235
2229
	*attrflagp = 0;
2236
	*attrflagp = 0;
2230
	NFSCL_REQSTART(nd, NFSPROC_DEALLOCATE, vp);
2237
	NFSCL_REQSTART(nd, NFSPROC_DEALLOCATE, vp, cred);
2231
	nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSTATEID);
2238
	nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSTATEID);
2232
	NFSM_BUILD(tl, uint32_t *, 2 * NFSX_HYPER);
2239
	NFSM_BUILD(tl, uint32_t *, 2 * NFSX_HYPER);
2233
	txdr_hyper(offs, tl);
2240
	txdr_hyper(offs, tl);
Lines 2280-2286 nfsrpc_mknod(vnode_t dvp, char *name, int namelen, str Link Here
2280
	*dattrflagp = 0;
2287
	*dattrflagp = 0;
2281
	if (namelen > NFS_MAXNAMLEN)
2288
	if (namelen > NFS_MAXNAMLEN)
2282
		return (ENAMETOOLONG);
2289
		return (ENAMETOOLONG);
2283
	NFSCL_REQSTART(nd, NFSPROC_MKNOD, dvp);
2290
	NFSCL_REQSTART(nd, NFSPROC_MKNOD, dvp, cred);
2284
	if (nd->nd_flag & ND_NFSV4) {
2291
	if (nd->nd_flag & ND_NFSV4) {
2285
		if (vtyp == VBLK || vtyp == VCHR) {
2292
		if (vtyp == VBLK || vtyp == VCHR) {
2286
			NFSM_BUILD(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
2293
			NFSM_BUILD(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
Lines 2429-2435 nfsrpc_createv23(vnode_t dvp, char *name, int namelen, Link Here
2429
	*dattrflagp = 0;
2436
	*dattrflagp = 0;
2430
	if (namelen > NFS_MAXNAMLEN)
2437
	if (namelen > NFS_MAXNAMLEN)
2431
		return (ENAMETOOLONG);
2438
		return (ENAMETOOLONG);
2432
	NFSCL_REQSTART(nd, NFSPROC_CREATE, dvp);
2439
	NFSCL_REQSTART(nd, NFSPROC_CREATE, dvp, cred);
2433
	(void) nfsm_strtom(nd, name, namelen);
2440
	(void) nfsm_strtom(nd, name, namelen);
2434
	if (nd->nd_flag & ND_NFSV3) {
2441
	if (nd->nd_flag & ND_NFSV3) {
2435
		NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
2442
		NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
Lines 2491-2497 nfsrpc_createv4(vnode_t dvp, char *name, int namelen, Link Here
2491
	*dattrflagp = 0;
2498
	*dattrflagp = 0;
2492
	if (namelen > NFS_MAXNAMLEN)
2499
	if (namelen > NFS_MAXNAMLEN)
2493
		return (ENAMETOOLONG);
2500
		return (ENAMETOOLONG);
2494
	NFSCL_REQSTART(nd, NFSPROC_CREATE, dvp);
2501
	NFSCL_REQSTART(nd, NFSPROC_CREATE, dvp, cred);
2495
	/*
2502
	/*
2496
	 * For V4, this is actually an Open op.
2503
	 * For V4, this is actually an Open op.
2497
	 */
2504
	 */
Lines 2732-2738 tryagain: Link Here
2732
	if (NFSHASNFSV4(nmp) && ret == 0) {
2739
	if (NFSHASNFSV4(nmp) && ret == 0) {
2733
		ret = nfscl_removedeleg(vp, p, &dstateid);
2740
		ret = nfscl_removedeleg(vp, p, &dstateid);
2734
		if (ret == 1) {
2741
		if (ret == 1) {
2735
			NFSCL_REQSTART(nd, NFSPROC_RETDELEGREMOVE, vp);
2742
			NFSCL_REQSTART(nd, NFSPROC_RETDELEGREMOVE, vp, cred);
2736
			NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID +
2743
			NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID +
2737
			    NFSX_UNSIGNED);
2744
			    NFSX_UNSIGNED);
2738
			if (NFSHASNFSV4N(nmp))
2745
			if (NFSHASNFSV4N(nmp))
Lines 2753-2759 tryagain: Link Here
2753
		ret = 0;
2760
		ret = 0;
2754
	}
2761
	}
2755
	if (ret == 0)
2762
	if (ret == 0)
2756
		NFSCL_REQSTART(nd, NFSPROC_REMOVE, dvp);
2763
		NFSCL_REQSTART(nd, NFSPROC_REMOVE, dvp, cred);
2757
	(void) nfsm_strtom(nd, name, namelen);
2764
	(void) nfsm_strtom(nd, name, namelen);
2758
	error = nfscl_request(nd, dvp, p, cred);
2765
	error = nfscl_request(nd, dvp, p, cred);
2759
	if (error)
2766
	if (error)
Lines 2813-2823 tryagain: Link Here
2813
		ret = nfscl_renamedeleg(fvp, &fdstateid, &gotfd, tvp,
2820
		ret = nfscl_renamedeleg(fvp, &fdstateid, &gotfd, tvp,
2814
		    &tdstateid, &gottd, p);
2821
		    &tdstateid, &gottd, p);
2815
		if (gotfd && gottd) {
2822
		if (gotfd && gottd) {
2816
			NFSCL_REQSTART(nd, NFSPROC_RETDELEGRENAME2, fvp);
2823
			NFSCL_REQSTART(nd, NFSPROC_RETDELEGRENAME2, fvp, cred);
2817
		} else if (gotfd) {
2824
		} else if (gotfd) {
2818
			NFSCL_REQSTART(nd, NFSPROC_RETDELEGRENAME1, fvp);
2825
			NFSCL_REQSTART(nd, NFSPROC_RETDELEGRENAME1, fvp, cred);
2819
		} else if (gottd) {
2826
		} else if (gottd) {
2820
			NFSCL_REQSTART(nd, NFSPROC_RETDELEGRENAME1, tvp);
2827
			NFSCL_REQSTART(nd, NFSPROC_RETDELEGRENAME1, tvp, cred);
2821
		}
2828
		}
2822
		if (gotfd) {
2829
		if (gotfd) {
2823
			NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID);
2830
			NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID);
Lines 2861-2867 tryagain: Link Here
2861
		ret = 0;
2868
		ret = 0;
2862
	}
2869
	}
2863
	if (ret == 0)
2870
	if (ret == 0)
2864
		NFSCL_REQSTART(nd, NFSPROC_RENAME, fdvp);
2871
		NFSCL_REQSTART(nd, NFSPROC_RENAME, fdvp, cred);
2865
	if (nd->nd_flag & ND_NFSV4) {
2872
	if (nd->nd_flag & ND_NFSV4) {
2866
		NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
2873
		NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
2867
		*tl = txdr_unsigned(NFSV4OP_GETATTR);
2874
		*tl = txdr_unsigned(NFSV4OP_GETATTR);
Lines 2960-2966 nfsrpc_link(vnode_t dvp, vnode_t vp, char *name, int n Link Here
2960
	*dattrflagp = 0;
2967
	*dattrflagp = 0;
2961
	if (namelen > NFS_MAXNAMLEN)
2968
	if (namelen > NFS_MAXNAMLEN)
2962
		return (ENAMETOOLONG);
2969
		return (ENAMETOOLONG);
2963
	NFSCL_REQSTART(nd, NFSPROC_LINK, vp);
2970
	NFSCL_REQSTART(nd, NFSPROC_LINK, vp, cred);
2964
	if (nd->nd_flag & ND_NFSV4) {
2971
	if (nd->nd_flag & ND_NFSV4) {
2965
		NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
2972
		NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
2966
		*tl = txdr_unsigned(NFSV4OP_PUTFH);
2973
		*tl = txdr_unsigned(NFSV4OP_PUTFH);
Lines 3027-3033 nfsrpc_symlink(vnode_t dvp, char *name, int namelen, c Link Here
3027
	slen = strlen(target);
3034
	slen = strlen(target);
3028
	if (slen > NFS_MAXPATHLEN || namelen > NFS_MAXNAMLEN)
3035
	if (slen > NFS_MAXPATHLEN || namelen > NFS_MAXNAMLEN)
3029
		return (ENAMETOOLONG);
3036
		return (ENAMETOOLONG);
3030
	NFSCL_REQSTART(nd, NFSPROC_SYMLINK, dvp);
3037
	NFSCL_REQSTART(nd, NFSPROC_SYMLINK, dvp, cred);
3031
	if (nd->nd_flag & ND_NFSV4) {
3038
	if (nd->nd_flag & ND_NFSV4) {
3032
		NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
3039
		NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
3033
		*tl = txdr_unsigned(NFLNK);
3040
		*tl = txdr_unsigned(NFLNK);
Lines 3090-3096 nfsrpc_mkdir(vnode_t dvp, char *name, int namelen, str Link Here
3090
	fhp = VTONFS(dvp)->n_fhp;
3097
	fhp = VTONFS(dvp)->n_fhp;
3091
	if (namelen > NFS_MAXNAMLEN)
3098
	if (namelen > NFS_MAXNAMLEN)
3092
		return (ENAMETOOLONG);
3099
		return (ENAMETOOLONG);
3093
	NFSCL_REQSTART(nd, NFSPROC_MKDIR, dvp);
3100
	NFSCL_REQSTART(nd, NFSPROC_MKDIR, dvp, cred);
3094
	if (nd->nd_flag & ND_NFSV4) {
3101
	if (nd->nd_flag & ND_NFSV4) {
3095
		NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
3102
		NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
3096
		*tl = txdr_unsigned(NFDIR);
3103
		*tl = txdr_unsigned(NFDIR);
Lines 3162-3168 nfsrpc_rmdir(vnode_t dvp, char *name, int namelen, str Link Here
3162
	*dattrflagp = 0;
3169
	*dattrflagp = 0;
3163
	if (namelen > NFS_MAXNAMLEN)
3170
	if (namelen > NFS_MAXNAMLEN)
3164
		return (ENAMETOOLONG);
3171
		return (ENAMETOOLONG);
3165
	NFSCL_REQSTART(nd, NFSPROC_RMDIR, dvp);
3172
	NFSCL_REQSTART(nd, NFSPROC_RMDIR, dvp, cred);
3166
	(void) nfsm_strtom(nd, name, namelen);
3173
	(void) nfsm_strtom(nd, name, namelen);
3167
	error = nfscl_request(nd, dvp, p, cred);
3174
	error = nfscl_request(nd, dvp, p, cred);
3168
	if (error)
3175
	if (error)
Lines 3279-3285 nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64 Link Here
3279
		 * Joy, oh joy. For V4 we get to hand craft '.' and '..'.
3286
		 * Joy, oh joy. For V4 we get to hand craft '.' and '..'.
3280
		 */
3287
		 */
3281
		if (uiop->uio_offset == 0) {
3288
		if (uiop->uio_offset == 0) {
3282
			NFSCL_REQSTART(nd, NFSPROC_LOOKUPP, vp);
3289
			NFSCL_REQSTART(nd, NFSPROC_LOOKUPP, vp, cred);
3283
			NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
3290
			NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
3284
			*tl++ = txdr_unsigned(NFSV4OP_GETFH);
3291
			*tl++ = txdr_unsigned(NFSV4OP_GETFH);
3285
			*tl = txdr_unsigned(NFSV4OP_GETATTR);
3292
			*tl = txdr_unsigned(NFSV4OP_GETATTR);
Lines 3396-3402 nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64 Link Here
3396
	 */
3403
	 */
3397
	while (more_dirs && bigenough) {
3404
	while (more_dirs && bigenough) {
3398
		*attrflagp = 0;
3405
		*attrflagp = 0;
3399
		NFSCL_REQSTART(nd, NFSPROC_READDIR, vp);
3406
		NFSCL_REQSTART(nd, NFSPROC_READDIR, vp, cred);
3400
		if (nd->nd_flag & ND_NFSV2) {
3407
		if (nd->nd_flag & ND_NFSV2) {
3401
			NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
3408
			NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
3402
			*tl++ = cookie.lval[1];
3409
			*tl++ = cookie.lval[1];
Lines 3721-3727 nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsui Link Here
3721
		 * Joy, oh joy. For V4 we get to hand craft '.' and '..'.
3728
		 * Joy, oh joy. For V4 we get to hand craft '.' and '..'.
3722
		 */
3729
		 */
3723
		if (uiop->uio_offset == 0) {
3730
		if (uiop->uio_offset == 0) {
3724
			NFSCL_REQSTART(nd, NFSPROC_LOOKUPP, vp);
3731
			NFSCL_REQSTART(nd, NFSPROC_LOOKUPP, vp, cred);
3725
			NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
3732
			NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
3726
			*tl++ = txdr_unsigned(NFSV4OP_GETFH);
3733
			*tl++ = txdr_unsigned(NFSV4OP_GETFH);
3727
			*tl = txdr_unsigned(NFSV4OP_GETATTR);
3734
			*tl = txdr_unsigned(NFSV4OP_GETATTR);
Lines 3843-3849 nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsui Link Here
3843
	 */
3850
	 */
3844
	while (more_dirs && bigenough) {
3851
	while (more_dirs && bigenough) {
3845
		*attrflagp = 0;
3852
		*attrflagp = 0;
3846
		NFSCL_REQSTART(nd, NFSPROC_READDIRPLUS, vp);
3853
		NFSCL_REQSTART(nd, NFSPROC_READDIRPLUS, vp, cred);
3847
 		NFSM_BUILD(tl, u_int32_t *, 6 * NFSX_UNSIGNED);
3854
 		NFSM_BUILD(tl, u_int32_t *, 6 * NFSX_UNSIGNED);
3848
		*tl++ = cookie.lval[0];
3855
		*tl++ = cookie.lval[0];
3849
		*tl++ = cookie.lval[1];
3856
		*tl++ = cookie.lval[1];
Lines 4198-4204 nfsrpc_commit(vnode_t vp, u_quad_t offset, int cnt, st Link Here
4198
	struct nfsmount *nmp = VFSTONFS(vp->v_mount);
4205
	struct nfsmount *nmp = VFSTONFS(vp->v_mount);
4199
4206
4200
	*attrflagp = 0;
4207
	*attrflagp = 0;
4201
	NFSCL_REQSTART(nd, NFSPROC_COMMIT, vp);
4208
	NFSCL_REQSTART(nd, NFSPROC_COMMIT, vp, cred);
4202
	NFSM_BUILD(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
4209
	NFSM_BUILD(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
4203
	txdr_hyper(offset, tl);
4210
	txdr_hyper(offset, tl);
4204
	tl += 2;
4211
	tl += 2;
Lines 4418-4424 nfsrpc_lockt(struct nfsrv_descript *nd, vnode_t vp, Link Here
4418
	struct nfsclsession *tsep;
4425
	struct nfsclsession *tsep;
4419
4426
4420
	nmp = VFSTONFS(vp->v_mount);
4427
	nmp = VFSTONFS(vp->v_mount);
4421
	NFSCL_REQSTART(nd, NFSPROC_LOCKT, vp);
4428
	NFSCL_REQSTART(nd, NFSPROC_LOCKT, vp, cred);
4422
	NFSM_BUILD(tl, u_int32_t *, 7 * NFSX_UNSIGNED);
4429
	NFSM_BUILD(tl, u_int32_t *, 7 * NFSX_UNSIGNED);
4423
	if (fl->l_type == F_RDLCK)
4430
	if (fl->l_type == F_RDLCK)
4424
		*tl++ = txdr_unsigned(NFSV4LOCKT_READ);
4431
		*tl++ = txdr_unsigned(NFSV4LOCKT_READ);
Lines 4489-4495 nfsrpc_locku(struct nfsrv_descript *nd, struct nfsmoun Link Here
4489
	int error;
4496
	int error;
4490
4497
4491
	nfscl_reqstart(nd, NFSPROC_LOCKU, nmp, lp->nfsl_open->nfso_fh,
4498
	nfscl_reqstart(nd, NFSPROC_LOCKU, nmp, lp->nfsl_open->nfso_fh,
4492
	    lp->nfsl_open->nfso_fhlen, NULL, NULL, 0, 0);
4499
	    lp->nfsl_open->nfso_fhlen, NULL, NULL, 0, 0, cred);
4493
	NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID + 6 * NFSX_UNSIGNED);
4500
	NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID + 6 * NFSX_UNSIGNED);
4494
	*tl++ = txdr_unsigned(type);
4501
	*tl++ = txdr_unsigned(type);
4495
	*tl = txdr_unsigned(lp->nfsl_seqid);
4502
	*tl = txdr_unsigned(lp->nfsl_seqid);
Lines 4541-4547 nfsrpc_lock(struct nfsrv_descript *nd, struct nfsmount Link Here
4541
	uint8_t own[NFSV4CL_LOCKNAMELEN + NFSX_V4FHMAX];
4548
	uint8_t own[NFSV4CL_LOCKNAMELEN + NFSX_V4FHMAX];
4542
	struct nfsclsession *tsep;
4549
	struct nfsclsession *tsep;
4543
4550
4544
	nfscl_reqstart(nd, NFSPROC_LOCK, nmp, nfhp, fhlen, NULL, NULL, 0, 0);
4551
	nfscl_reqstart(nd, NFSPROC_LOCK, nmp, nfhp, fhlen, NULL, NULL, 0, 0,
4552
	    cred);
4545
	NFSM_BUILD(tl, u_int32_t *, 7 * NFSX_UNSIGNED);
4553
	NFSM_BUILD(tl, u_int32_t *, 7 * NFSX_UNSIGNED);
4546
	if (type == F_RDLCK)
4554
	if (type == F_RDLCK)
4547
		*tl++ = txdr_unsigned(NFSV4LOCKT_READ);
4555
		*tl++ = txdr_unsigned(NFSV4LOCKT_READ);
Lines 4636-4642 nfsrpc_statfs(vnode_t vp, struct nfsstatfs *sbp, struc Link Here
4636
		/*
4644
		/*
4637
		 * For V4, you actually do a getattr.
4645
		 * For V4, you actually do a getattr.
4638
		 */
4646
		 */
4639
		NFSCL_REQSTART(nd, NFSPROC_GETATTR, vp);
4647
		NFSCL_REQSTART(nd, NFSPROC_GETATTR, vp, cred);
4640
		NFSSTATFS_GETATTRBIT(&attrbits);
4648
		NFSSTATFS_GETATTRBIT(&attrbits);
4641
		(void) nfsrv_putattrbit(nd, &attrbits);
4649
		(void) nfsrv_putattrbit(nd, &attrbits);
4642
		nd->nd_flag |= ND_USEGSSNAME;
4650
		nd->nd_flag |= ND_USEGSSNAME;
Lines 4659-4665 nfsrpc_statfs(vnode_t vp, struct nfsstatfs *sbp, struc Link Here
4659
		if (error)
4667
		if (error)
4660
			goto nfsmout;
4668
			goto nfsmout;
4661
	} else {
4669
	} else {
4662
		NFSCL_REQSTART(nd, NFSPROC_FSSTAT, vp);
4670
		NFSCL_REQSTART(nd, NFSPROC_FSSTAT, vp, cred);
4663
		error = nfscl_request(nd, vp, p, cred);
4671
		error = nfscl_request(nd, vp, p, cred);
4664
		if (error)
4672
		if (error)
4665
			return (error);
4673
			return (error);
Lines 4715-4721 nfsrpc_pathconf(vnode_t vp, struct nfsv3_pathconf *pc, Link Here
4715
		/*
4723
		/*
4716
		 * For V4, you actually do a getattr.
4724
		 * For V4, you actually do a getattr.
4717
		 */
4725
		 */
4718
		NFSCL_REQSTART(nd, NFSPROC_GETATTR, vp);
4726
		NFSCL_REQSTART(nd, NFSPROC_GETATTR, vp, cred);
4719
		NFSPATHCONF_GETATTRBIT(&attrbits);
4727
		NFSPATHCONF_GETATTRBIT(&attrbits);
4720
		(void) nfsrv_putattrbit(nd, &attrbits);
4728
		(void) nfsrv_putattrbit(nd, &attrbits);
4721
		nd->nd_flag |= ND_USEGSSNAME;
4729
		nd->nd_flag |= ND_USEGSSNAME;
Lines 4732-4738 nfsrpc_pathconf(vnode_t vp, struct nfsv3_pathconf *pc, Link Here
4732
			error = nd->nd_repstat;
4740
			error = nd->nd_repstat;
4733
		}
4741
		}
4734
	} else {
4742
	} else {
4735
		NFSCL_REQSTART(nd, NFSPROC_PATHCONF, vp);
4743
		NFSCL_REQSTART(nd, NFSPROC_PATHCONF, vp, cred);
4736
		error = nfscl_request(nd, vp, p, cred);
4744
		error = nfscl_request(nd, vp, p, cred);
4737
		if (error)
4745
		if (error)
4738
			return (error);
4746
			return (error);
Lines 4768-4774 nfsrpc_fsinfo(vnode_t vp, struct nfsfsinfo *fsp, struc Link Here
4768
	int error;
4776
	int error;
4769
4777
4770
	*attrflagp = 0;
4778
	*attrflagp = 0;
4771
	NFSCL_REQSTART(nd, NFSPROC_FSINFO, vp);
4779
	NFSCL_REQSTART(nd, NFSPROC_FSINFO, vp, cred);
4772
	error = nfscl_request(nd, vp, p, cred);
4780
	error = nfscl_request(nd, vp, p, cred);
4773
	if (error)
4781
	if (error)
4774
		return (error);
4782
		return (error);
Lines 4815-4824 nfsrpc_renew(struct nfsclclient *clp, struct nfsclds * Link Here
4815
		return (0);
4823
		return (0);
4816
	if (dsp == NULL)
4824
	if (dsp == NULL)
4817
		nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL, NULL, 0,
4825
		nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL, NULL, 0,
4818
		    0);
4826
		    0, cred);
4819
	else
4827
	else
4820
		nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL,
4828
		nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL,
4821
		    &dsp->nfsclds_sess, 0, 0);
4829
		    &dsp->nfsclds_sess, 0, 0, NULL);
4822
	if (!NFSHASNFSV4N(nmp)) {
4830
	if (!NFSHASNFSV4N(nmp)) {
4823
		/* NFSv4.1 just uses a Sequence Op and not a Renew. */
4831
		/* NFSv4.1 just uses a Sequence Op and not a Renew. */
4824
		NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
4832
		NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
Lines 4865-4875 nfsrpc_rellockown(struct nfsmount *nmp, struct nfscllo Link Here
4865
	if (NFSHASNFSV4N(nmp)) {
4873
	if (NFSHASNFSV4N(nmp)) {
4866
		/* For NFSv4.1, do a FreeStateID. */
4874
		/* For NFSv4.1, do a FreeStateID. */
4867
		nfscl_reqstart(nd, NFSPROC_FREESTATEID, nmp, NULL, 0, NULL,
4875
		nfscl_reqstart(nd, NFSPROC_FREESTATEID, nmp, NULL, 0, NULL,
4868
		    NULL, 0, 0);
4876
		    NULL, 0, 0, cred);
4869
		nfsm_stateidtom(nd, &lp->nfsl_stateid, NFSSTATEID_PUTSTATEID);
4877
		nfsm_stateidtom(nd, &lp->nfsl_stateid, NFSSTATEID_PUTSTATEID);
4870
	} else {
4878
	} else {
4871
		nfscl_reqstart(nd, NFSPROC_RELEASELCKOWN, nmp, NULL, 0, NULL,
4879
		nfscl_reqstart(nd, NFSPROC_RELEASELCKOWN, nmp, NULL, 0, NULL,
4872
		    NULL, 0, 0);
4880
		    NULL, 0, 0, NULL);
4873
		NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
4881
		NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
4874
		tsep = nfsmnt_mdssession(nmp);
4882
		tsep = nfsmnt_mdssession(nmp);
4875
		*tl++ = tsep->nfsess_clientid.lval[0];
4883
		*tl++ = tsep->nfsess_clientid.lval[0];
Lines 4903-4909 nfsrpc_getdirpath(struct nfsmount *nmp, u_char *dirpat Link Here
4903
	u_int32_t *opcntp;
4911
	u_int32_t *opcntp;
4904
4912
4905
	nfscl_reqstart(nd, NFSPROC_PUTROOTFH, nmp, NULL, 0, &opcntp, NULL, 0,
4913
	nfscl_reqstart(nd, NFSPROC_PUTROOTFH, nmp, NULL, 0, &opcntp, NULL, 0,
4906
	    0);
4914
	    0, NULL);
4907
	cp = dirpath;
4915
	cp = dirpath;
4908
	cnt = 0;
4916
	cnt = 0;
4909
	do {
4917
	do {
Lines 4970-4976 nfsrpc_delegreturn(struct nfscldeleg *dp, struct ucred Link Here
4970
	int error;
4978
	int error;
4971
4979
4972
	nfscl_reqstart(nd, NFSPROC_DELEGRETURN, nmp, dp->nfsdl_fh,
4980
	nfscl_reqstart(nd, NFSPROC_DELEGRETURN, nmp, dp->nfsdl_fh,
4973
	    dp->nfsdl_fhlen, NULL, NULL, 0, 0);
4981
	    dp->nfsdl_fhlen, NULL, NULL, 0, 0, cred);
4974
	NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID);
4982
	NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID);
4975
	if (NFSHASNFSV4N(nmp))
4983
	if (NFSHASNFSV4N(nmp))
4976
		*tl++ = 0;
4984
		*tl++ = 0;
Lines 5004-5010 nfsrpc_getacl(vnode_t vp, struct ucred *cred, NFSPROC_ Link Here
5004
5012
5005
	if (nfsrv_useacl == 0 || !NFSHASNFSV4(nmp))
5013
	if (nfsrv_useacl == 0 || !NFSHASNFSV4(nmp))
5006
		return (EOPNOTSUPP);
5014
		return (EOPNOTSUPP);
5007
	NFSCL_REQSTART(nd, NFSPROC_GETACL, vp);
5015
	NFSCL_REQSTART(nd, NFSPROC_GETACL, vp, cred);
5008
	NFSZERO_ATTRBIT(&attrbits);
5016
	NFSZERO_ATTRBIT(&attrbits);
5009
	NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_ACL);
5017
	NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_ACL);
5010
	(void) nfsrv_putattrbit(nd, &attrbits);
5018
	(void) nfsrv_putattrbit(nd, &attrbits);
Lines 5050-5056 nfsrpc_setaclrpc(vnode_t vp, struct ucred *cred, NFSPR Link Here
5050
5058
5051
	if (!NFSHASNFSV4(nmp))
5059
	if (!NFSHASNFSV4(nmp))
5052
		return (EOPNOTSUPP);
5060
		return (EOPNOTSUPP);
5053
	NFSCL_REQSTART(nd, NFSPROC_SETACL, vp);
5061
	NFSCL_REQSTART(nd, NFSPROC_SETACL, vp, cred);
5054
	nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSTATEID);
5062
	nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSTATEID);
5055
	NFSZERO_ATTRBIT(&attrbits);
5063
	NFSZERO_ATTRBIT(&attrbits);
5056
	NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_ACL);
5064
	NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_ACL);
Lines 5083-5089 nfsrpc_exchangeid(struct nfsmount *nmp, struct nfsclcl Link Here
5083
	if (minorvers == 0)
5091
	if (minorvers == 0)
5084
		minorvers = nmp->nm_minorvers;
5092
		minorvers = nmp->nm_minorvers;
5085
	nfscl_reqstart(nd, NFSPROC_EXCHANGEID, nmp, NULL, 0, NULL, NULL,
5093
	nfscl_reqstart(nd, NFSPROC_EXCHANGEID, nmp, NULL, 0, NULL, NULL,
5086
	    NFS_VER4, minorvers);
5094
	    NFS_VER4, minorvers, NULL);
5087
	NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED);
5095
	NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED);
5088
	*tl++ = txdr_unsigned(nfsboottime.tv_sec);	/* Client owner */
5096
	*tl++ = txdr_unsigned(nfsboottime.tv_sec);	/* Client owner */
5089
	*tl = txdr_unsigned(clp->nfsc_rev);
5097
	*tl = txdr_unsigned(clp->nfsc_rev);
Lines 5179-5185 nfsrpc_createsession(struct nfsmount *nmp, struct nfsc Link Here
5179
	else
5187
	else
5180
		minorvers = NFSV41_MINORVERSION;
5188
		minorvers = NFSV41_MINORVERSION;
5181
	nfscl_reqstart(nd, NFSPROC_CREATESESSION, nmp, NULL, 0, NULL, NULL,
5189
	nfscl_reqstart(nd, NFSPROC_CREATESESSION, nmp, NULL, 0, NULL, NULL,
5182
	    NFS_VER4, minorvers);
5190
	    NFS_VER4, minorvers, NULL);
5183
	NFSM_BUILD(tl, uint32_t *, 4 * NFSX_UNSIGNED);
5191
	NFSM_BUILD(tl, uint32_t *, 4 * NFSX_UNSIGNED);
5184
	*tl++ = sep->nfsess_clientid.lval[0];
5192
	*tl++ = sep->nfsess_clientid.lval[0];
5185
	*tl++ = sep->nfsess_clientid.lval[1];
5193
	*tl++ = sep->nfsess_clientid.lval[1];
Lines 5297-5330 nfsmout: Link Here
5297
}
5305
}
5298
5306
5299
/*
5307
/*
5300
 * Do the NFSv4.1 Destroy Session.
5301
 */
5302
int
5303
nfsrpc_destroysession(struct nfsmount *nmp, struct nfsclclient *clp,
5304
    struct ucred *cred, NFSPROC_T *p)
5305
{
5306
	uint32_t *tl;
5307
	struct nfsrv_descript nfsd;
5308
	struct nfsrv_descript *nd = &nfsd;
5309
	int error;
5310
	struct nfsclsession *tsep;
5311
5312
	nfscl_reqstart(nd, NFSPROC_DESTROYSESSION, nmp, NULL, 0, NULL, NULL, 0,
5313
	    0);
5314
	NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID);
5315
	tsep = nfsmnt_mdssession(nmp);
5316
	bcopy(tsep->nfsess_sessionid, tl, NFSX_V4SESSIONID);
5317
	nd->nd_flag |= ND_USEGSSNAME;
5318
	error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, NULL, p, cred,
5319
	    NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL);
5320
	if (error != 0)
5321
		return (error);
5322
	error = nd->nd_repstat;
5323
	m_freem(nd->nd_mrep);
5324
	return (error);
5325
}
5326
5327
/*
5328
 * Do the NFSv4.1 Destroy Client.
5308
 * Do the NFSv4.1 Destroy Client.
5329
 */
5309
 */
5330
int
5310
int
Lines 5338-5344 nfsrpc_destroyclient(struct nfsmount *nmp, struct nfsc Link Here
5338
	struct nfsclsession *tsep;
5318
	struct nfsclsession *tsep;
5339
5319
5340
	nfscl_reqstart(nd, NFSPROC_DESTROYCLIENT, nmp, NULL, 0, NULL, NULL, 0,
5320
	nfscl_reqstart(nd, NFSPROC_DESTROYCLIENT, nmp, NULL, 0, NULL, NULL, 0,
5341
	    0);
5321
	    0, NULL);
5342
	NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED);
5322
	NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED);
5343
	tsep = nfsmnt_mdssession(nmp);
5323
	tsep = nfsmnt_mdssession(nmp);
5344
	*tl++ = tsep->nfsess_clientid.lval[0];
5324
	*tl++ = tsep->nfsess_clientid.lval[0];
Lines 5367-5373 nfsrpc_layoutget(struct nfsmount *nmp, uint8_t *fhp, i Link Here
5367
	int error;
5347
	int error;
5368
5348
5369
	nfscl_reqstart(nd, NFSPROC_LAYOUTGET, nmp, fhp, fhlen, NULL, NULL, 0,
5349
	nfscl_reqstart(nd, NFSPROC_LAYOUTGET, nmp, fhp, fhlen, NULL, NULL, 0,
5370
	    0);
5350
	    0, cred);
5371
	nfsrv_setuplayoutget(nd, iomode, offset, len, minlen, stateidp,
5351
	nfsrv_setuplayoutget(nd, iomode, offset, len, minlen, stateidp,
5372
	    layouttype, layoutlen, 0);
5352
	    layouttype, layoutlen, 0);
5373
	nd->nd_flag |= ND_USEGSSNAME;
5353
	nd->nd_flag |= ND_USEGSSNAME;
Lines 5411-5417 nfsrpc_getdeviceinfo(struct nfsmount *nmp, uint8_t *de Link Here
5411
	ndi = NULL;
5391
	ndi = NULL;
5412
	gotdspp = NULL;
5392
	gotdspp = NULL;
5413
	nfscl_reqstart(nd, NFSPROC_GETDEVICEINFO, nmp, NULL, 0, NULL, NULL, 0,
5393
	nfscl_reqstart(nd, NFSPROC_GETDEVICEINFO, nmp, NULL, 0, NULL, NULL, 0,
5414
	    0);
5394
	    0, cred);
5415
	NFSM_BUILD(tl, uint32_t *, NFSX_V4DEVICEID + 3 * NFSX_UNSIGNED);
5395
	NFSM_BUILD(tl, uint32_t *, NFSX_V4DEVICEID + 3 * NFSX_UNSIGNED);
5416
	NFSBCOPY(deviceid, tl, NFSX_V4DEVICEID);
5396
	NFSBCOPY(deviceid, tl, NFSX_V4DEVICEID);
5417
	tl += (NFSX_V4DEVICEID / NFSX_UNSIGNED);
5397
	tl += (NFSX_V4DEVICEID / NFSX_UNSIGNED);
Lines 5632-5638 nfsrpc_layoutcommit(struct nfsmount *nmp, uint8_t *fh, Link Here
5632
	int error;
5612
	int error;
5633
5613
5634
	nfscl_reqstart(nd, NFSPROC_LAYOUTCOMMIT, nmp, fh, fhlen, NULL, NULL,
5614
	nfscl_reqstart(nd, NFSPROC_LAYOUTCOMMIT, nmp, fh, fhlen, NULL, NULL,
5635
	    0, 0);
5615
	    0, 0, cred);
5636
	NFSM_BUILD(tl, uint32_t *, 5 * NFSX_UNSIGNED + 3 * NFSX_HYPER +
5616
	NFSM_BUILD(tl, uint32_t *, 5 * NFSX_UNSIGNED + 3 * NFSX_HYPER +
5637
	    NFSX_STATEID);
5617
	    NFSX_STATEID);
5638
	txdr_hyper(off, tl);
5618
	txdr_hyper(off, tl);
Lines 5683-5689 nfsrpc_layoutreturn(struct nfsmount *nmp, uint8_t *fh, Link Here
5683
	int error;
5663
	int error;
5684
5664
5685
	nfscl_reqstart(nd, NFSPROC_LAYOUTRETURN, nmp, fh, fhlen, NULL, NULL,
5665
	nfscl_reqstart(nd, NFSPROC_LAYOUTRETURN, nmp, fh, fhlen, NULL, NULL,
5686
	    0, 0);
5666
	    0, 0, cred);
5687
	NFSM_BUILD(tl, uint32_t *, 4 * NFSX_UNSIGNED);
5667
	NFSM_BUILD(tl, uint32_t *, 4 * NFSX_UNSIGNED);
5688
	if (reclaim != 0)
5668
	if (reclaim != 0)
5689
		*tl++ = newnfs_true;
5669
		*tl++ = newnfs_true;
Lines 5769-5775 nfsrpc_layouterror(struct nfsmount *nmp, uint8_t *fh, Link Here
5769
	int error;
5749
	int error;
5770
5750
5771
	nfscl_reqstart(nd, NFSPROC_LAYOUTERROR, nmp, fh, fhlen, NULL, NULL,
5751
	nfscl_reqstart(nd, NFSPROC_LAYOUTERROR, nmp, fh, fhlen, NULL, NULL,
5772
	    0, 0);
5752
	    0, 0, cred);
5773
	NFSM_BUILD(tl, uint32_t *, 2 * NFSX_HYPER + NFSX_STATEID +
5753
	NFSM_BUILD(tl, uint32_t *, 2 * NFSX_HYPER + NFSX_STATEID +
5774
	    NFSX_V4DEVICEID + 3 * NFSX_UNSIGNED);
5754
	    NFSX_V4DEVICEID + 3 * NFSX_UNSIGNED);
5775
	txdr_hyper(offset, tl); tl += 2;
5755
	txdr_hyper(offset, tl); tl += 2;
Lines 6078-6084 nfsrpc_reclaimcomplete(struct nfsmount *nmp, struct uc Link Here
6078
	int error;
6058
	int error;
6079
6059
6080
	nfscl_reqstart(nd, NFSPROC_RECLAIMCOMPL, nmp, NULL, 0, NULL, NULL, 0,
6060
	nfscl_reqstart(nd, NFSPROC_RECLAIMCOMPL, nmp, NULL, 0, NULL, NULL, 0,
6081
	    0);
6061
	    0, cred);
6082
	NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED);
6062
	NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED);
6083
	*tl = newnfs_false;
6063
	*tl = newnfs_false;
6084
	nd->nd_flag |= ND_USEGSSNAME;
6064
	nd->nd_flag |= ND_USEGSSNAME;
Lines 6107-6112 nfscl_initsessionslots(struct nfsclsession *sep) Link Here
6107
	for (i = 0; i < 64; i++)
6087
	for (i = 0; i < 64; i++)
6108
		sep->nfsess_slotseq[i] = 0;
6088
		sep->nfsess_slotseq[i] = 0;
6109
	sep->nfsess_slots = 0;
6089
	sep->nfsess_slots = 0;
6090
	sep->nfsess_badslots = 0;
6110
}
6091
}
6111
6092
6112
/*
6093
/*
Lines 6701-6707 nfsrpc_readds(vnode_t vp, struct uio *uiop, nfsv4state Link Here
6701
	nd->nd_mrep = NULL;
6682
	nd->nd_mrep = NULL;
6702
	if (vers == 0 || vers == NFS_VER4) {
6683
	if (vers == 0 || vers == NFS_VER4) {
6703
		nfscl_reqstart(nd, NFSPROC_READDS, nmp, fhp->nfh_fh,
6684
		nfscl_reqstart(nd, NFSPROC_READDS, nmp, fhp->nfh_fh,
6704
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers);
6685
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers,
6686
		    NULL);
6705
		vers = NFS_VER4;
6687
		vers = NFS_VER4;
6706
		NFSCL_DEBUG(4, "nfsrpc_readds: vers4 minvers=%d\n", minorvers);
6688
		NFSCL_DEBUG(4, "nfsrpc_readds: vers4 minvers=%d\n", minorvers);
6707
		if (flex != 0)
6689
		if (flex != 0)
Lines 6710-6716 nfsrpc_readds(vnode_t vp, struct uio *uiop, nfsv4state Link Here
6710
			nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSEQIDZERO);
6692
			nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSEQIDZERO);
6711
	} else {
6693
	} else {
6712
		nfscl_reqstart(nd, NFSPROC_READ, nmp, fhp->nfh_fh,
6694
		nfscl_reqstart(nd, NFSPROC_READ, nmp, fhp->nfh_fh,
6713
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers);
6695
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers,
6696
		    NULL);
6714
		NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_READ]);
6697
		NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_READ]);
6715
		NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_READDS]);
6698
		NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_READDS]);
6716
		NFSCL_DEBUG(4, "nfsrpc_readds: vers3\n");
6699
		NFSCL_DEBUG(4, "nfsrpc_readds: vers3\n");
Lines 6777-6783 nfsrpc_writeds(vnode_t vp, struct uio *uiop, int *iomo Link Here
6777
	nd->nd_mrep = NULL;
6760
	nd->nd_mrep = NULL;
6778
	if (vers == 0 || vers == NFS_VER4) {
6761
	if (vers == 0 || vers == NFS_VER4) {
6779
		nfscl_reqstart(nd, NFSPROC_WRITEDS, nmp, fhp->nfh_fh,
6762
		nfscl_reqstart(nd, NFSPROC_WRITEDS, nmp, fhp->nfh_fh,
6780
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers);
6763
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers,
6764
		    NULL);
6781
		NFSCL_DEBUG(4, "nfsrpc_writeds: vers4 minvers=%d\n", minorvers);
6765
		NFSCL_DEBUG(4, "nfsrpc_writeds: vers4 minvers=%d\n", minorvers);
6782
		vers = NFS_VER4;
6766
		vers = NFS_VER4;
6783
		if (flex != 0)
6767
		if (flex != 0)
Lines 6787-6793 nfsrpc_writeds(vnode_t vp, struct uio *uiop, int *iomo Link Here
6787
		NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + 2 * NFSX_UNSIGNED);
6771
		NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + 2 * NFSX_UNSIGNED);
6788
	} else {
6772
	} else {
6789
		nfscl_reqstart(nd, NFSPROC_WRITE, nmp, fhp->nfh_fh,
6773
		nfscl_reqstart(nd, NFSPROC_WRITE, nmp, fhp->nfh_fh,
6790
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers);
6774
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers,
6775
		    NULL);
6791
		NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITE]);
6776
		NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITE]);
6792
		NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITEDS]);
6777
		NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITEDS]);
6793
		NFSCL_DEBUG(4, "nfsrpc_writeds: vers3\n");
6778
		NFSCL_DEBUG(4, "nfsrpc_writeds: vers3\n");
Lines 6910-6916 nfsrpc_writedsmir(vnode_t vp, int *iomode, int *must_c Link Here
6910
	nd->nd_mrep = NULL;
6895
	nd->nd_mrep = NULL;
6911
	if (vers == 0 || vers == NFS_VER4) {
6896
	if (vers == 0 || vers == NFS_VER4) {
6912
		nfscl_reqstart(nd, NFSPROC_WRITEDS, nmp, fhp->nfh_fh,
6897
		nfscl_reqstart(nd, NFSPROC_WRITEDS, nmp, fhp->nfh_fh,
6913
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers);
6898
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers,
6899
		    NULL);
6914
		vers = NFS_VER4;
6900
		vers = NFS_VER4;
6915
		NFSCL_DEBUG(4, "nfsrpc_writedsmir: vers4 minvers=%d\n",
6901
		NFSCL_DEBUG(4, "nfsrpc_writedsmir: vers4 minvers=%d\n",
6916
		    minorvers);
6902
		    minorvers);
Lines 6918-6924 nfsrpc_writedsmir(vnode_t vp, int *iomode, int *must_c Link Here
6918
		NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + 2 * NFSX_UNSIGNED);
6904
		NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + 2 * NFSX_UNSIGNED);
6919
	} else {
6905
	} else {
6920
		nfscl_reqstart(nd, NFSPROC_WRITE, nmp, fhp->nfh_fh,
6906
		nfscl_reqstart(nd, NFSPROC_WRITE, nmp, fhp->nfh_fh,
6921
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers);
6907
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers,
6908
		    NULL);
6922
		NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITE]);
6909
		NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITE]);
6923
		NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITEDS]);
6910
		NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITEDS]);
6924
		NFSCL_DEBUG(4, "nfsrpc_writedsmir: vers3\n");
6911
		NFSCL_DEBUG(4, "nfsrpc_writedsmir: vers3\n");
Lines 7138-7148 nfsrpc_commitds(vnode_t vp, uint64_t offset, int cnt, Link Here
7138
	nd->nd_mrep = NULL;
7125
	nd->nd_mrep = NULL;
7139
	if (vers == 0 || vers == NFS_VER4) {
7126
	if (vers == 0 || vers == NFS_VER4) {
7140
		nfscl_reqstart(nd, NFSPROC_COMMITDS, nmp, fhp->nfh_fh,
7127
		nfscl_reqstart(nd, NFSPROC_COMMITDS, nmp, fhp->nfh_fh,
7141
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers);
7128
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers,
7129
		    NULL);
7142
		vers = NFS_VER4;
7130
		vers = NFS_VER4;
7143
	} else {
7131
	} else {
7144
		nfscl_reqstart(nd, NFSPROC_COMMIT, nmp, fhp->nfh_fh,
7132
		nfscl_reqstart(nd, NFSPROC_COMMIT, nmp, fhp->nfh_fh,
7145
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers);
7133
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers,
7134
		    NULL);
7146
		NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_COMMIT]);
7135
		NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_COMMIT]);
7147
		NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_COMMITDS]);
7136
		NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_COMMITDS]);
7148
	}
7137
	}
Lines 7257-7263 nfsrpc_advise(vnode_t vp, off_t offset, uint64_t cnt, Link Here
7257
		NFSSETBIT_ATTRBIT(&hints, NFSV4IOHINT_DONTNEED);
7246
		NFSSETBIT_ATTRBIT(&hints, NFSV4IOHINT_DONTNEED);
7258
	else
7247
	else
7259
		return (0);
7248
		return (0);
7260
	NFSCL_REQSTART(nd, NFSPROC_IOADVISE, vp);
7249
	NFSCL_REQSTART(nd, NFSPROC_IOADVISE, vp, cred);
7261
	nfsm_stateidtom(nd, NULL, NFSSTATEID_PUTALLZERO);
7250
	nfsm_stateidtom(nd, NULL, NFSSTATEID_PUTALLZERO);
7262
	NFSM_BUILD(tl, uint32_t *, 2 * NFSX_HYPER);
7251
	NFSM_BUILD(tl, uint32_t *, 2 * NFSX_HYPER);
7263
	txdr_hyper(offset, tl);
7252
	txdr_hyper(offset, tl);
Lines 7301-7307 nfsrpc_adviseds(vnode_t vp, uint64_t offset, int cnt, Link Here
7301
		return (0);
7290
		return (0);
7302
	nd->nd_mrep = NULL;
7291
	nd->nd_mrep = NULL;
7303
	nfscl_reqstart(nd, NFSPROC_IOADVISEDS, nmp, fhp->nfh_fh,
7292
	nfscl_reqstart(nd, NFSPROC_IOADVISEDS, nmp, fhp->nfh_fh,
7304
	    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers);
7293
	    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers, NULL);
7305
	vers = NFS_VER4;
7294
	vers = NFS_VER4;
7306
	NFSCL_DEBUG(4, "nfsrpc_adviseds: vers=%d minvers=%d\n", vers,
7295
	NFSCL_DEBUG(4, "nfsrpc_adviseds: vers=%d minvers=%d\n", vers,
7307
	    minorvers);
7296
	    minorvers);
Lines 7470-7476 nfsrpc_allocaterpc(vnode_t vp, off_t off, off_t len, n Link Here
7470
	nfsattrbit_t attrbits;
7459
	nfsattrbit_t attrbits;
7471
7460
7472
	*attrflagp = 0;
7461
	*attrflagp = 0;
7473
	NFSCL_REQSTART(nd, NFSPROC_ALLOCATE, vp);
7462
	NFSCL_REQSTART(nd, NFSPROC_ALLOCATE, vp, cred);
7474
	nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSTATEID);
7463
	nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSTATEID);
7475
	NFSM_BUILD(tl, uint32_t *, 2 * NFSX_HYPER + NFSX_UNSIGNED);
7464
	NFSM_BUILD(tl, uint32_t *, 2 * NFSX_HYPER + NFSX_UNSIGNED);
7476
	txdr_hyper(off, tl); tl += 2;
7465
	txdr_hyper(off, tl); tl += 2;
Lines 7958-7964 nfsrpc_openlayoutrpc(struct nfsmount *nmp, vnode_t vp, Link Here
7958
	*dpp = NULL;
7947
	*dpp = NULL;
7959
	*laystatp = ENXIO;
7948
	*laystatp = ENXIO;
7960
	nfscl_reqstart(nd, NFSPROC_OPENLAYGET, nmp, nfhp, fhlen, NULL, NULL,
7949
	nfscl_reqstart(nd, NFSPROC_OPENLAYGET, nmp, nfhp, fhlen, NULL, NULL,
7961
	    0, 0);
7950
	    0, 0, cred);
7962
	NFSM_BUILD(tl, uint32_t *, 5 * NFSX_UNSIGNED);
7951
	NFSM_BUILD(tl, uint32_t *, 5 * NFSX_UNSIGNED);
7963
	*tl++ = txdr_unsigned(op->nfso_own->nfsow_seqid);
7952
	*tl++ = txdr_unsigned(op->nfso_own->nfsow_seqid);
7964
	*tl++ = txdr_unsigned(mode & NFSV4OPEN_ACCESSBOTH);
7953
	*tl++ = txdr_unsigned(mode & NFSV4OPEN_ACCESSBOTH);
Lines 8143-8149 nfsrpc_createlayout(vnode_t dvp, char *name, int namel Link Here
8143
	*dattrflagp = 0;
8132
	*dattrflagp = 0;
8144
	if (namelen > NFS_MAXNAMLEN)
8133
	if (namelen > NFS_MAXNAMLEN)
8145
		return (ENAMETOOLONG);
8134
		return (ENAMETOOLONG);
8146
	NFSCL_REQSTART(nd, NFSPROC_CREATELAYGET, dvp);
8135
	NFSCL_REQSTART(nd, NFSPROC_CREATELAYGET, dvp, cred);
8147
	/*
8136
	/*
8148
	 * For V4, this is actually an Open op.
8137
	 * For V4, this is actually an Open op.
8149
	 */
8138
	 */
Lines 8355-8361 nfsrpc_createlayout(vnode_t dvp, char *name, int namel Link Here
8355
	}
8344
	}
8356
	if (nd->nd_repstat != 0 && error == 0)
8345
	if (nd->nd_repstat != 0 && error == 0)
8357
		error = nd->nd_repstat;
8346
		error = nd->nd_repstat;
8358
	if (error == NFSERR_STALECLIENTID || error == NFSERR_BADSESSION)
8347
	if (error == NFSERR_STALECLIENTID)
8359
		nfscl_initiate_recovery(owp->nfsow_clp);
8348
		nfscl_initiate_recovery(owp->nfsow_clp);
8360
nfsmout:
8349
nfsmout:
8361
	NFSCL_DEBUG(4, "eo nfsrpc_createlayout err=%d\n", error);
8350
	NFSCL_DEBUG(4, "eo nfsrpc_createlayout err=%d\n", error);
Lines 8584-8590 nfsrpc_copyrpc(vnode_t invp, off_t inoff, vnode_t outv Link Here
8584
	*lenp = 0;
8573
	*lenp = 0;
8585
	if (len > nfs_maxcopyrange)
8574
	if (len > nfs_maxcopyrange)
8586
		len = nfs_maxcopyrange;
8575
		len = nfs_maxcopyrange;
8587
	NFSCL_REQSTART(nd, NFSPROC_COPY, invp);
8576
	NFSCL_REQSTART(nd, NFSPROC_COPY, invp, cred);
8588
	NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED);
8577
	NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED);
8589
	*tl = txdr_unsigned(NFSV4OP_GETATTR);
8578
	*tl = txdr_unsigned(NFSV4OP_GETATTR);
8590
	NFSGETATTR_ATTRBIT(&attrbits);
8579
	NFSGETATTR_ATTRBIT(&attrbits);
Lines 8749-8755 nfsrpc_seekrpc(vnode_t vp, off_t *offp, nfsv4stateid_t Link Here
8749
	nfsattrbit_t attrbits;
8738
	nfsattrbit_t attrbits;
8750
8739
8751
	*attrflagp = 0;
8740
	*attrflagp = 0;
8752
	NFSCL_REQSTART(nd, NFSPROC_SEEK, vp);
8741
	NFSCL_REQSTART(nd, NFSPROC_SEEK, vp, cred);
8753
	nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSTATEID);
8742
	nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSTATEID);
8754
	NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + 2 * NFSX_UNSIGNED);
8743
	NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + 2 * NFSX_UNSIGNED);
8755
	txdr_hyper(*offp, tl); tl += 2;
8744
	txdr_hyper(*offp, tl); tl += 2;
Lines 8793-8799 nfsrpc_getextattr(vnode_t vp, const char *name, struct Link Here
8793
	uint32_t len, len2;
8782
	uint32_t len, len2;
8794
8783
8795
	*attrflagp = 0;
8784
	*attrflagp = 0;
8796
	NFSCL_REQSTART(nd, NFSPROC_GETEXTATTR, vp);
8785
	NFSCL_REQSTART(nd, NFSPROC_GETEXTATTR, vp, cred);
8797
	nfsm_strtom(nd, name, strlen(name));
8786
	nfsm_strtom(nd, name, strlen(name));
8798
	NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED);
8787
	NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED);
8799
	*tl = txdr_unsigned(NFSV4OP_GETATTR);
8788
	*tl = txdr_unsigned(NFSV4OP_GETATTR);
Lines 8863-8869 nfsrpc_setextattr(vnode_t vp, const char *name, struct Link Here
8863
	nfsattrbit_t attrbits;
8852
	nfsattrbit_t attrbits;
8864
8853
8865
	*attrflagp = 0;
8854
	*attrflagp = 0;
8866
	NFSCL_REQSTART(nd, NFSPROC_SETEXTATTR, vp);
8855
	NFSCL_REQSTART(nd, NFSPROC_SETEXTATTR, vp, cred);
8867
	if (uiop->uio_resid > nd->nd_maxreq) {
8856
	if (uiop->uio_resid > nd->nd_maxreq) {
8868
		/* nd_maxreq is set by NFSCL_REQSTART(). */
8857
		/* nd_maxreq is set by NFSCL_REQSTART(). */
8869
		m_freem(nd->nd_mreq);
8858
		m_freem(nd->nd_mreq);
Lines 8911-8917 nfsrpc_rmextattr(vnode_t vp, const char *name, struct Link Here
8911
	nfsattrbit_t attrbits;
8900
	nfsattrbit_t attrbits;
8912
8901
8913
	*attrflagp = 0;
8902
	*attrflagp = 0;
8914
	NFSCL_REQSTART(nd, NFSPROC_RMEXTATTR, vp);
8903
	NFSCL_REQSTART(nd, NFSPROC_RMEXTATTR, vp, cred);
8915
	nfsm_strtom(nd, name, strlen(name));
8904
	nfsm_strtom(nd, name, strlen(name));
8916
	NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED);
8905
	NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED);
8917
	*tl = txdr_unsigned(NFSV4OP_GETATTR);
8906
	*tl = txdr_unsigned(NFSV4OP_GETATTR);
Lines 8951-8957 nfsrpc_listextattr(vnode_t vp, uint64_t *cookiep, stru Link Here
8951
	u_char c;
8940
	u_char c;
8952
8941
8953
	*attrflagp = 0;
8942
	*attrflagp = 0;
8954
	NFSCL_REQSTART(nd, NFSPROC_LISTEXTATTR, vp);
8943
	NFSCL_REQSTART(nd, NFSPROC_LISTEXTATTR, vp, cred);
8955
	NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + 2 * NFSX_UNSIGNED);
8944
	NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + 2 * NFSX_UNSIGNED);
8956
	txdr_hyper(*cookiep, tl); tl += 2;
8945
	txdr_hyper(*cookiep, tl); tl += 2;
8957
	*tl++ = txdr_unsigned(*lenp);
8946
	*tl++ = txdr_unsigned(*lenp);
Lines 9125-9131 nfsrpc_bindconnsess(CLIENT *cl, void *arg, struct ucre Link Here
9125
	int error;
9114
	int error;
9126
9115
9127
	nfscl_reqstart(nd, NFSPROC_BINDCONNTOSESS, NULL, NULL, 0, NULL, NULL,
9116
	nfscl_reqstart(nd, NFSPROC_BINDCONNTOSESS, NULL, NULL, 0, NULL, NULL,
9128
	    NFS_VER4, rcp->minorvers);
9117
	    NFS_VER4, rcp->minorvers, NULL);
9129
	NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID + 2 * NFSX_UNSIGNED);
9118
	NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID + 2 * NFSX_UNSIGNED);
9130
	memcpy(tl, rcp->sessionid, NFSX_V4SESSIONID);
9119
	memcpy(tl, rcp->sessionid, NFSX_V4SESSIONID);
9131
	tl += NFSX_V4SESSIONID / NFSX_UNSIGNED;
9120
	tl += NFSX_V4SESSIONID / NFSX_UNSIGNED;
(-)sys/fs/nfsclient/nfs_clstate.c (-3 / +2 lines)
Lines 2087-2093 nfscl_umount(struct nfsmount *nmp, NFSPROC_T *p, struc Link Here
2087
		nfscl_delegreturnall(clp, p, dhp);
2087
		nfscl_delegreturnall(clp, p, dhp);
2088
		cred = newnfs_getcred();
2088
		cred = newnfs_getcred();
2089
		if (NFSHASNFSV4N(nmp)) {
2089
		if (NFSHASNFSV4N(nmp)) {
2090
			(void)nfsrpc_destroysession(nmp, clp, cred, p);
2090
			(void)nfsrpc_destroysession(nmp, NULL, cred, p);
2091
			(void)nfsrpc_destroyclient(nmp, clp, cred, p);
2091
			(void)nfsrpc_destroyclient(nmp, clp, cred, p);
2092
		} else
2092
		} else
2093
			(void)nfsrpc_setclient(nmp, clp, 0, NULL, cred, p);
2093
			(void)nfsrpc_setclient(nmp, clp, 0, NULL, cred, p);
Lines 2765-2772 nfscl_renewthread(struct nfsclclient *clp, NFSPROC_T * Link Here
2765
			error = nfsrpc_renew(clp, NULL, cred, p);
2765
			error = nfsrpc_renew(clp, NULL, cred, p);
2766
			if (error == NFSERR_CBPATHDOWN)
2766
			if (error == NFSERR_CBPATHDOWN)
2767
			    cbpathdown = 1;
2767
			    cbpathdown = 1;
2768
			else if (error == NFSERR_STALECLIENTID ||
2768
			else if (error == NFSERR_STALECLIENTID) {
2769
			    error == NFSERR_BADSESSION) {
2770
			    NFSLOCKCLSTATE();
2769
			    NFSLOCKCLSTATE();
2771
			    clp->nfsc_flags |= NFSCLFLAGS_RECOVER;
2770
			    clp->nfsc_flags |= NFSCLFLAGS_RECOVER;
2772
			    NFSUNLOCKCLSTATE();
2771
			    NFSUNLOCKCLSTATE();
(-)sys/fs/nfsserver/nfs_nfsdstate.c (-1 / +1 lines)
Lines 6638-6644 nfsv4_setcbsequence(struct nfsrv_descript *nd, struct Link Here
6638
		return (error);
6638
		return (error);
6639
	sep = *sepp;
6639
	sep = *sepp;
6640
	(void)nfsv4_sequencelookup(NULL, &sep->sess_cbsess, slotposp, &maxslot,
6640
	(void)nfsv4_sequencelookup(NULL, &sep->sess_cbsess, slotposp, &maxslot,
6641
	    &slotseq, sessionid);
6641
	    &slotseq, sessionid, true);
6642
	KASSERT(maxslot >= 0, ("nfsv4_setcbsequence neg maxslot"));
6642
	KASSERT(maxslot >= 0, ("nfsv4_setcbsequence neg maxslot"));
6643
6643
6644
	/* Build the Sequence arguments. */
6644
	/* Build the Sequence arguments. */
(-)sys/fs/nfsserver/nfs_nfsdport.c (-8 / +8 lines)
Lines 5234-5240 nfsrv_readdsrpc(fhandle_t *fhp, off_t off, int len, st Link Here
5234
	st.other[2] = 0x55555555;
5234
	st.other[2] = 0x55555555;
5235
	st.seqid = 0xffffffff;
5235
	st.seqid = 0xffffffff;
5236
	nfscl_reqstart(nd, NFSPROC_READDS, nmp, (u_int8_t *)fhp, sizeof(*fhp),
5236
	nfscl_reqstart(nd, NFSPROC_READDS, nmp, (u_int8_t *)fhp, sizeof(*fhp),
5237
	    NULL, NULL, 0, 0);
5237
	    NULL, NULL, 0, 0, NULL);
5238
	nfsm_stateidtom(nd, &st, NFSSTATEID_PUTSTATEID);
5238
	nfsm_stateidtom(nd, &st, NFSSTATEID_PUTSTATEID);
5239
	NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED * 3);
5239
	NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED * 3);
5240
	txdr_hyper(off, tl);
5240
	txdr_hyper(off, tl);
Lines 5342-5348 nfsrv_writedsdorpc(struct nfsmount *nmp, fhandle_t *fh Link Here
5342
5342
5343
	nd = malloc(sizeof(*nd), M_TEMP, M_WAITOK | M_ZERO);
5343
	nd = malloc(sizeof(*nd), M_TEMP, M_WAITOK | M_ZERO);
5344
	nfscl_reqstart(nd, NFSPROC_WRITE, nmp, (u_int8_t *)fhp,
5344
	nfscl_reqstart(nd, NFSPROC_WRITE, nmp, (u_int8_t *)fhp,
5345
	    sizeof(fhandle_t), NULL, NULL, 0, 0);
5345
	    sizeof(fhandle_t), NULL, NULL, 0, 0, NULL);
5346
5346
5347
	/*
5347
	/*
5348
	 * Use a stateid where other is an alternating 01010 pattern and
5348
	 * Use a stateid where other is an alternating 01010 pattern and
Lines 5564-5570 nfsrv_allocatedsdorpc(struct nfsmount *nmp, fhandle_t Link Here
5564
5564
5565
	nd = malloc(sizeof(*nd), M_TEMP, M_WAITOK | M_ZERO);
5565
	nd = malloc(sizeof(*nd), M_TEMP, M_WAITOK | M_ZERO);
5566
	nfscl_reqstart(nd, NFSPROC_ALLOCATE, nmp, (u_int8_t *)fhp,
5566
	nfscl_reqstart(nd, NFSPROC_ALLOCATE, nmp, (u_int8_t *)fhp,
5567
	    sizeof(fhandle_t), NULL, NULL, 0, 0);
5567
	    sizeof(fhandle_t), NULL, NULL, 0, 0, NULL);
5568
5568
5569
	/*
5569
	/*
5570
	 * Use a stateid where other is an alternating 01010 pattern and
5570
	 * Use a stateid where other is an alternating 01010 pattern and
Lines 5724-5730 nfsrv_deallocatedsdorpc(struct nfsmount *nmp, fhandle_ Link Here
5724
5724
5725
	nd = malloc(sizeof(*nd), M_TEMP, M_WAITOK | M_ZERO);
5725
	nd = malloc(sizeof(*nd), M_TEMP, M_WAITOK | M_ZERO);
5726
	nfscl_reqstart(nd, NFSPROC_DEALLOCATE, nmp, (u_int8_t *)fhp,
5726
	nfscl_reqstart(nd, NFSPROC_DEALLOCATE, nmp, (u_int8_t *)fhp,
5727
	    sizeof(fhandle_t), NULL, NULL, 0, 0);
5727
	    sizeof(fhandle_t), NULL, NULL, 0, 0, NULL);
5728
5728
5729
	/*
5729
	/*
5730
	 * Use a stateid where other is an alternating 01010 pattern and
5730
	 * Use a stateid where other is an alternating 01010 pattern and
Lines 5899-5905 nfsrv_setattrdsdorpc(fhandle_t *fhp, struct ucred *cre Link Here
5899
	st.other[2] = 0x55555555;
5899
	st.other[2] = 0x55555555;
5900
	st.seqid = 0xffffffff;
5900
	st.seqid = 0xffffffff;
5901
	nfscl_reqstart(nd, NFSPROC_SETATTR, nmp, (u_int8_t *)fhp, sizeof(*fhp),
5901
	nfscl_reqstart(nd, NFSPROC_SETATTR, nmp, (u_int8_t *)fhp, sizeof(*fhp),
5902
	    NULL, NULL, 0, 0);
5902
	    NULL, NULL, 0, 0, NULL);
5903
	nfsm_stateidtom(nd, &st, NFSSTATEID_PUTSTATEID);
5903
	nfsm_stateidtom(nd, &st, NFSSTATEID_PUTSTATEID);
5904
	nfscl_fillsattr(nd, &nap->na_vattr, vp, NFSSATTR_FULL, 0);
5904
	nfscl_fillsattr(nd, &nap->na_vattr, vp, NFSSATTR_FULL, 0);
5905
5905
Lines 6084-6090 nfsrv_setacldsdorpc(fhandle_t *fhp, struct ucred *cred Link Here
6084
	st.other[2] = 0x55555555;
6084
	st.other[2] = 0x55555555;
6085
	st.seqid = 0xffffffff;
6085
	st.seqid = 0xffffffff;
6086
	nfscl_reqstart(nd, NFSPROC_SETACL, nmp, (u_int8_t *)fhp, sizeof(*fhp),
6086
	nfscl_reqstart(nd, NFSPROC_SETACL, nmp, (u_int8_t *)fhp, sizeof(*fhp),
6087
	    NULL, NULL, 0, 0);
6087
	    NULL, NULL, 0, 0, NULL);
6088
	nfsm_stateidtom(nd, &st, NFSSTATEID_PUTSTATEID);
6088
	nfsm_stateidtom(nd, &st, NFSSTATEID_PUTSTATEID);
6089
	NFSZERO_ATTRBIT(&attrbits);
6089
	NFSZERO_ATTRBIT(&attrbits);
6090
	NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_ACL);
6090
	NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_ACL);
Lines 6219-6225 nfsrv_getattrdsrpc(fhandle_t *fhp, struct ucred *cred, Link Here
6219
	NFSD_DEBUG(4, "in nfsrv_getattrdsrpc\n");
6219
	NFSD_DEBUG(4, "in nfsrv_getattrdsrpc\n");
6220
	nd = malloc(sizeof(*nd), M_TEMP, M_WAITOK | M_ZERO);
6220
	nd = malloc(sizeof(*nd), M_TEMP, M_WAITOK | M_ZERO);
6221
	nfscl_reqstart(nd, NFSPROC_GETATTR, nmp, (u_int8_t *)fhp,
6221
	nfscl_reqstart(nd, NFSPROC_GETATTR, nmp, (u_int8_t *)fhp,
6222
	    sizeof(fhandle_t), NULL, NULL, 0, 0);
6222
	    sizeof(fhandle_t), NULL, NULL, 0, 0, NULL);
6223
	NFSZERO_ATTRBIT(&attrbits);
6223
	NFSZERO_ATTRBIT(&attrbits);
6224
	NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_SIZE);
6224
	NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_SIZE);
6225
	NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_CHANGE);
6225
	NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_CHANGE);
Lines 6287-6293 nfsrv_seekdsrpc(fhandle_t *fhp, off_t *offp, int conte Link Here
6287
	st.seqid = 0xffffffff;
6287
	st.seqid = 0xffffffff;
6288
	nd = malloc(sizeof(*nd), M_TEMP, M_WAITOK | M_ZERO);
6288
	nd = malloc(sizeof(*nd), M_TEMP, M_WAITOK | M_ZERO);
6289
	nfscl_reqstart(nd, NFSPROC_SEEKDS, nmp, (u_int8_t *)fhp,
6289
	nfscl_reqstart(nd, NFSPROC_SEEKDS, nmp, (u_int8_t *)fhp,
6290
	    sizeof(fhandle_t), NULL, NULL, 0, 0);
6290
	    sizeof(fhandle_t), NULL, NULL, 0, 0, NULL);
6291
	nfsm_stateidtom(nd, &st, NFSSTATEID_PUTSTATEID);
6291
	nfsm_stateidtom(nd, &st, NFSSTATEID_PUTSTATEID);
6292
	NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + NFSX_UNSIGNED);
6292
	NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + NFSX_UNSIGNED);
6293
	txdr_hyper(*offp, tl); tl += 2;
6293
	txdr_hyper(*offp, tl); tl += 2;

Return to bug 260011