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

Collapse All | Expand All

(-)sys/fs/nfs/nfs_var.h (-5 / +6 lines)
Lines 315-321 void nfsrc_trimcache(uint64_t, uint32_t, int); Link Here
315
315
316
/* nfs_commonsubs.c */
316
/* nfs_commonsubs.c */
317
void nfscl_reqstart(struct nfsrv_descript *, int, struct nfsmount *,
317
void nfscl_reqstart(struct nfsrv_descript *, int, struct nfsmount *,
318
    u_int8_t *, int, u_int32_t **, struct nfsclsession *, int, int);
318
    u_int8_t *, int, u_int32_t **, struct nfsclsession *, int, int,
319
    struct ucred *);
319
void nfsm_stateidtom(struct nfsrv_descript *, nfsv4stateid_t *, int);
320
void nfsm_stateidtom(struct nfsrv_descript *, nfsv4stateid_t *, int);
320
void nfscl_fillsattr(struct nfsrv_descript *, struct vattr *,
321
void nfscl_fillsattr(struct nfsrv_descript *, struct vattr *,
321
      vnode_t, int, u_int32_t);
322
      vnode_t, int, u_int32_t);
Lines 355-368 int nfsv4_seqsession(uint32_t, uint32_t, uint32_t, str Link Here
355
    struct mbuf **, uint16_t);
356
    struct mbuf **, uint16_t);
356
void nfsv4_seqsess_cacherep(uint32_t, struct nfsslot *, int, struct mbuf **);
357
void nfsv4_seqsess_cacherep(uint32_t, struct nfsslot *, int, struct mbuf **);
357
void nfsv4_setsequence(struct nfsmount *, struct nfsrv_descript *,
358
void nfsv4_setsequence(struct nfsmount *, struct nfsrv_descript *,
358
    struct nfsclsession *, int);
359
    struct nfsclsession *, int, struct ucred *);
359
int nfsv4_sequencelookup(struct nfsmount *, struct nfsclsession *, int *,
360
int nfsv4_sequencelookup(struct nfsmount *, struct nfsclsession *, int *,
360
    int *, uint32_t *, uint8_t *);
361
    int *, uint32_t *, uint8_t *, bool);
361
void nfsv4_freeslot(struct nfsclsession *, int, bool);
362
void nfsv4_freeslot(struct nfsclsession *, int, bool);
362
struct ucred *nfsrv_getgrpscred(struct ucred *);
363
struct ucred *nfsrv_getgrpscred(struct ucred *);
363
struct nfsdevice *nfsv4_findmirror(struct nfsmount *);
364
struct nfsdevice *nfsv4_findmirror(struct nfsmount *);
364
void nfsm_set(struct nfsrv_descript *, u_int);
365
void nfsm_set(struct nfsrv_descript *, u_int);
365
struct mbuf *nfsm_add_ext_pgs(struct mbuf *, int, int *);
366
struct mbuf *nfsm_add_ext_pgs(struct mbuf *, int, int *);
367
int nfsrpc_destroysession(struct nfsmount *, struct nfsclsession *,
368
    struct ucred *, NFSPROC_T *);
366
369
367
/* nfs_clcomsubs.c */
370
/* nfs_clcomsubs.c */
368
void nfsm_uiombuf(struct nfsrv_descript *, struct uio *, int);
371
void nfsm_uiombuf(struct nfsrv_descript *, struct uio *, int);
Lines 529-536 int nfsrpc_exchangeid(struct nfsmount *, struct nfsclc Link Here
529
int nfsrpc_createsession(struct nfsmount *, struct nfsclsession *,
532
int nfsrpc_createsession(struct nfsmount *, struct nfsclsession *,
530
    struct nfssockreq *, struct nfsclds *, uint32_t, int, struct ucred *,
533
    struct nfssockreq *, struct nfsclds *, uint32_t, int, struct ucred *,
531
    NFSPROC_T *);
534
    NFSPROC_T *);
532
int nfsrpc_destroysession(struct nfsmount *, struct nfsclclient *,
533
    struct ucred *, NFSPROC_T *);
534
int nfsrpc_destroyclient(struct nfsmount *, struct nfsclclient *,
535
int nfsrpc_destroyclient(struct nfsmount *, struct nfsclclient *,
535
    struct ucred *, NFSPROC_T *);
536
    struct ucred *, NFSPROC_T *);
536
int nfsrpc_getdeviceinfo(struct nfsmount *, uint8_t *, int, uint32_t *,
537
int nfsrpc_getdeviceinfo(struct nfsmount *, uint8_t *, int, uint32_t *,
(-)sys/fs/nfs/nfs_commonkrpc.c (-10 / +48 lines)
Lines 919-934 tryagain: Link Here
919
	} else if (stat == RPC_TIMEDOUT) {
919
	} else if (stat == RPC_TIMEDOUT) {
920
		NFSINCRGLOBAL(nfsstatsv1.rpctimeouts);
920
		NFSINCRGLOBAL(nfsstatsv1.rpctimeouts);
921
		error = ETIMEDOUT;
921
		error = ETIMEDOUT;
922
printf("Etimedout!\n");
922
	} else if (stat == RPC_VERSMISMATCH) {
923
	} else if (stat == RPC_VERSMISMATCH) {
923
		NFSINCRGLOBAL(nfsstatsv1.rpcinvalid);
924
		NFSINCRGLOBAL(nfsstatsv1.rpcinvalid);
924
		error = EOPNOTSUPP;
925
		error = EOPNOTSUPP;
925
	} else if (stat == RPC_PROGVERSMISMATCH) {
926
	} else if (stat == RPC_PROGVERSMISMATCH) {
926
		NFSINCRGLOBAL(nfsstatsv1.rpcinvalid);
927
		NFSINCRGLOBAL(nfsstatsv1.rpcinvalid);
927
		error = EPROTONOSUPPORT;
928
		error = EPROTONOSUPPORT;
928
	} else if (stat == RPC_INTR) {
929
		error = EINTR;
930
	} else if (stat == RPC_CANTSEND || stat == RPC_CANTRECV ||
929
	} else if (stat == RPC_CANTSEND || stat == RPC_CANTRECV ||
931
	     stat == RPC_SYSTEMERROR) {
930
	     stat == RPC_SYSTEMERROR || stat == RPC_INTR) {
932
		/* Check for a session slot that needs to be free'd. */
931
		/* Check for a session slot that needs to be free'd. */
933
		if ((nd->nd_flag & (ND_NFSV41 | ND_HASSLOTID)) ==
932
		if ((nd->nd_flag & (ND_NFSV41 | ND_HASSLOTID)) ==
934
		    (ND_NFSV41 | ND_HASSLOTID) && nmp != NULL &&
933
		    (ND_NFSV41 | ND_HASSLOTID) && nmp != NULL &&
Lines 949-962 tryagain: Link Here
949
			 * this slot will result in an NFSERR_SEQMISORDERED
948
			 * this slot will result in an NFSERR_SEQMISORDERED
950
			 * error and not a bogus cached RPC reply.
949
			 * error and not a bogus cached RPC reply.
951
			 */
950
			 */
951
printf("Disable slot=%d\n", nd->nd_slotid);
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);
957
		}
958
		}
958
		NFSINCRGLOBAL(nfsstatsv1.rpcinvalid);
959
		if (stat == RPC_INTR)
959
		error = ENXIO;
960
			error = EINTR;
961
		else {
962
			NFSINCRGLOBAL(nfsstatsv1.rpcinvalid);
963
			error = ENXIO;
964
		}
960
	} else {
965
	} else {
961
		NFSINCRGLOBAL(nfsstatsv1.rpcinvalid);
966
		NFSINCRGLOBAL(nfsstatsv1.rpcinvalid);
962
		error = EACCES;
967
		error = EACCES;
Lines 1019-1026 tryagain: Link Here
1019
			 * If the first op is Sequence, free up the slot.
1024
			 * If the first op is Sequence, free up the slot.
1020
			 */
1025
			 */
1021
			if ((nmp != NULL && i == NFSV4OP_SEQUENCE && j != 0) ||
1026
			if ((nmp != NULL && i == NFSV4OP_SEQUENCE && j != 0) ||
1022
			    (clp != NULL && i == NFSV4OP_CBSEQUENCE && j != 0))
1027
			   (clp != NULL && i == NFSV4OP_CBSEQUENCE && j != 0)) {
1023
				NFSCL_DEBUG(1, "failed seq=%d\n", j);
1028
				NFSCL_DEBUG(1, "failed seq=%d\n", j);
1029
				if (sep != NULL && i == NFSV4OP_SEQUENCE &&
1030
				    j == NFSERR_SEQMISORDERED) {
1031
					mtx_lock(&sep->nfsess_mtx);
1032
					sep->nfsess_badslots |=
1033
					    (0x1ULL << nd->nd_slotid);
1034
					mtx_unlock(&sep->nfsess_mtx);
1035
				}
1036
			}
1024
			if (((nmp != NULL && i == NFSV4OP_SEQUENCE && j == 0) ||
1037
			if (((nmp != NULL && i == NFSV4OP_SEQUENCE && j == 0) ||
1025
			    (clp != NULL && i == NFSV4OP_CBSEQUENCE &&
1038
			    (clp != NULL && i == NFSV4OP_CBSEQUENCE &&
1026
			    j == 0)) && sep != NULL) {
1039
			    j == 0)) && sep != NULL) {
Lines 1039-1049 tryagain: Link Here
1039
					retseq = fxdr_unsigned(uint32_t, *tl++);
1052
					retseq = fxdr_unsigned(uint32_t, *tl++);
1040
					slot = fxdr_unsigned(int, *tl++);
1053
					slot = fxdr_unsigned(int, *tl++);
1041
					if ((nd->nd_flag & ND_HASSLOTID) != 0) {
1054
					if ((nd->nd_flag & ND_HASSLOTID) != 0) {
1042
						if (slot != nd->nd_slotid) {
1055
						if (slot >= NFSV4_SLOTS ||
1056
						    (i == NFSV4OP_CBSEQUENCE &&
1057
						     slot >= NFSV4_CBSLOTS)) {
1043
							printf("newnfs_request:"
1058
							printf("newnfs_request:"
1044
							    " Wrong session "
1059
							    " Bogus slot\n");
1045
							    "slot=%d\n", slot);
1046
							slot = nd->nd_slotid;
1060
							slot = nd->nd_slotid;
1061
						} else if (slot !=
1062
						    nd->nd_slotid) {
1063
						    printf("newnfs_request:"
1064
							" Wrong session "
1065
							"srvslot=%d "
1066
							"slot=%d\n", slot,
1067
							nd->nd_slotid);
1068
						    if (i == NFSV4OP_SEQUENCE) {
1069
							/*
1070
							 * Mark both slots as
1071
							 * bad, because we do
1072
							 * not know if the
1073
							 * server has advanced
1074
							 * the sequence# for
1075
							 * either of them.
1076
							 */
1077
							sep->nfsess_badslots |=
1078
							    (0x1ULL << slot);
1079
							sep->nfsess_badslots |=
1080
							    (0x1ULL <<
1081
							     nd->nd_slotid);
1082
						    }
1083
						    slot = nd->nd_slotid;
1047
						}
1084
						}
1048
					} else if (slot != 0) {
1085
					} else if (slot != 0) {
1049
						printf("newnfs_request: Bad "
1086
						printf("newnfs_request: Bad "
Lines 1096-1101 tryagain: Link Here
1096
				sep = NFSMNT_MDSSESSION(nmp);
1133
				sep = NFSMNT_MDSSESSION(nmp);
1097
				if (bcmp(sep->nfsess_sessionid, nd->nd_sequence,
1134
				if (bcmp(sep->nfsess_sessionid, nd->nd_sequence,
1098
				    NFSX_V4SESSIONID) == 0) {
1135
				    NFSX_V4SESSIONID) == 0) {
1136
printf("nfs_commonkrpc: initiate recovery\n");
1099
					/* Initiate recovery. */
1137
					/* Initiate recovery. */
1100
					sep->nfsess_defunct = 1;
1138
					sep->nfsess_defunct = 1;
1101
					NFSCL_DEBUG(1, "Marked defunct\n");
1139
					NFSCL_DEBUG(1, "Marked defunct\n");
Lines 1121-1127 tryagain: Link Here
1121
				if ((nd->nd_flag & ND_LOOPBADSESS) != 0) {
1159
				if ((nd->nd_flag & ND_LOOPBADSESS) != 0) {
1122
					reterr = nfsv4_sequencelookup(nmp, sep,
1160
					reterr = nfsv4_sequencelookup(nmp, sep,
1123
					    &slotpos, &maxslot, &slotseq,
1161
					    &slotpos, &maxslot, &slotseq,
1124
					    sessionid);
1162
					    sessionid, true);
1125
					if (reterr == 0) {
1163
					if (reterr == 0) {
1126
						/* Fill in new session info. */
1164
						/* Fill in new session info. */
1127
						NFSCL_DEBUG(1,
1165
						NFSCL_DEBUG(1,
(-)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/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/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/nfsclient/nfs_clrpcops.c (-120 / +125 lines)
Lines 239-245 nfsrpc_null(vnode_t vp, struct ucred *cred, NFSPROC_T Link Here
239
	int error;
239
	int error;
240
	struct nfsrv_descript nfsd, *nd = &nfsd;
240
	struct nfsrv_descript nfsd, *nd = &nfsd;
241
241
242
	NFSCL_REQSTART(nd, NFSPROC_NULL, vp);
242
	NFSCL_REQSTART(nd, NFSPROC_NULL, vp, NULL);
243
	error = nfscl_request(nd, vp, p, cred, NULL);
243
	error = nfscl_request(nd, vp, p, cred, NULL);
244
	if (nd->nd_repstat && !error)
244
	if (nd->nd_repstat && !error)
245
		error = nd->nd_repstat;
245
		error = nd->nd_repstat;
Lines 308-314 nfsrpc_accessrpc(vnode_t vp, u_int32_t mode, struct uc Link Here
308
308
309
	*attrflagp = 0;
309
	*attrflagp = 0;
310
	supported = mode;
310
	supported = mode;
311
	NFSCL_REQSTART(nd, NFSPROC_ACCESS, vp);
311
	NFSCL_REQSTART(nd, NFSPROC_ACCESS, vp, cred);
312
	NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
312
	NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
313
	*tl = txdr_unsigned(mode);
313
	*tl = txdr_unsigned(mode);
314
	if (nd->nd_flag & ND_NFSV4) {
314
	if (nd->nd_flag & ND_NFSV4) {
Lines 512-518 nfsrpc_openrpc(struct nfsmount *nmp, vnode_t vp, u_int Link Here
512
512
513
	dp = *dpp;
513
	dp = *dpp;
514
	*dpp = NULL;
514
	*dpp = NULL;
515
	nfscl_reqstart(nd, NFSPROC_OPEN, nmp, nfhp, fhlen, NULL, NULL, 0, 0);
515
	nfscl_reqstart(nd, NFSPROC_OPEN, nmp, nfhp, fhlen, NULL, NULL, 0, 0,
516
	    cred);
516
	NFSM_BUILD(tl, u_int32_t *, 5 * NFSX_UNSIGNED);
517
	NFSM_BUILD(tl, u_int32_t *, 5 * NFSX_UNSIGNED);
517
	*tl++ = txdr_unsigned(op->nfso_own->nfsow_seqid);
518
	*tl++ = txdr_unsigned(op->nfso_own->nfsow_seqid);
518
	*tl++ = txdr_unsigned(mode & NFSV4OPEN_ACCESSBOTH);
519
	*tl++ = txdr_unsigned(mode & NFSV4OPEN_ACCESSBOTH);
Lines 705-711 nfsrpc_opendowngrade(vnode_t vp, u_int32_t mode, struc Link Here
705
	struct nfsrv_descript nfsd, *nd = &nfsd;
706
	struct nfsrv_descript nfsd, *nd = &nfsd;
706
	int error;
707
	int error;
707
708
708
	NFSCL_REQSTART(nd, NFSPROC_OPENDOWNGRADE, vp);
709
	NFSCL_REQSTART(nd, NFSPROC_OPENDOWNGRADE, vp, cred);
709
	NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID + 3 * NFSX_UNSIGNED);
710
	NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID + 3 * NFSX_UNSIGNED);
710
	if (NFSHASNFSV4N(VFSTONFS(vp->v_mount)))
711
	if (NFSHASNFSV4N(VFSTONFS(vp->v_mount)))
711
		*tl++ = 0;
712
		*tl++ = 0;
Lines 870-876 nfsrpc_closerpc(struct nfsrv_descript *nd, struct nfsm Link Here
870
	int error;
871
	int error;
871
872
872
	nfscl_reqstart(nd, NFSPROC_CLOSE, nmp, op->nfso_fh,
873
	nfscl_reqstart(nd, NFSPROC_CLOSE, nmp, op->nfso_fh,
873
	    op->nfso_fhlen, NULL, NULL, 0, 0);
874
	    op->nfso_fhlen, NULL, NULL, 0, 0, cred);
874
	NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED + NFSX_STATEID);
875
	NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED + NFSX_STATEID);
875
	if (NFSHASNFSV4N(nmp)) {
876
	if (NFSHASNFSV4N(nmp)) {
876
		*tl++ = 0;
877
		*tl++ = 0;
Lines 916-922 nfsrpc_openconfirm(vnode_t vp, u_int8_t *nfhp, int fhl Link Here
916
	if (NFSHASNFSV4N(nmp))
917
	if (NFSHASNFSV4N(nmp))
917
		return (0);		/* No confirmation for NFSv4.1. */
918
		return (0);		/* No confirmation for NFSv4.1. */
918
	nfscl_reqstart(nd, NFSPROC_OPENCONFIRM, nmp, nfhp, fhlen, NULL, NULL,
919
	nfscl_reqstart(nd, NFSPROC_OPENCONFIRM, nmp, nfhp, fhlen, NULL, NULL,
919
	    0, 0);
920
	    0, 0, NULL);
920
	NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED + NFSX_STATEID);
921
	NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED + NFSX_STATEID);
921
	*tl++ = op->nfso_stateid.seqid;
922
	*tl++ = op->nfso_stateid.seqid;
922
	*tl++ = op->nfso_stateid.other[0];
923
	*tl++ = op->nfso_stateid.other[0];
Lines 1061-1070 nfsrpc_setclient(struct nfsmount *nmp, struct nfsclcli Link Here
1061
			 */
1062
			 */
1062
			tsep = NULL;
1063
			tsep = NULL;
1063
			if (TAILQ_FIRST(&nmp->nm_sess) != NULL) {
1064
			if (TAILQ_FIRST(&nmp->nm_sess) != NULL) {
1065
				/*
1066
				 * Mark the old session defunct.  Needed
1067
				 * when called from nfscl_hasexpired().
1068
				 */
1064
				tsep = NFSMNT_MDSSESSION(nmp);
1069
				tsep = NFSMNT_MDSSESSION(nmp);
1065
				if (tsep->nfsess_defunct == 0)
1070
				tsep->nfsess_defunct = 1;
1066
					printf("nfsrpc_setclient: "
1067
					    "nfsess_defunct not set\n");
1068
			}
1071
			}
1069
			TAILQ_INSERT_HEAD(&nmp->nm_sess, dsp,
1072
			TAILQ_INSERT_HEAD(&nmp->nm_sess, dsp,
1070
			    nfsclds_list);
1073
			    nfsclds_list);
Lines 1107-1113 nfsrpc_setclient(struct nfsmount *nmp, struct nfsclcli Link Here
1107
	tsep = NFSMNT_MDSSESSION(nmp);
1110
	tsep = NFSMNT_MDSSESSION(nmp);
1108
	NFSUNLOCKMNT(nmp);
1111
	NFSUNLOCKMNT(nmp);
1109
1112
1110
	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);
1111
	NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
1115
	NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
1112
	*tl++ = txdr_unsigned(nfsboottime.tv_sec);
1116
	*tl++ = txdr_unsigned(nfsboottime.tv_sec);
1113
	*tl = txdr_unsigned(clp->nfsc_rev);
1117
	*tl = txdr_unsigned(clp->nfsc_rev);
Lines 1177-1183 nfsrpc_setclient(struct nfsmount *nmp, struct nfsclcli Link Here
1177
	     * and confirm it.
1181
	     * and confirm it.
1178
	     */
1182
	     */
1179
	    nfscl_reqstart(nd, NFSPROC_SETCLIENTIDCFRM, nmp, NULL, 0, NULL,
1183
	    nfscl_reqstart(nd, NFSPROC_SETCLIENTIDCFRM, nmp, NULL, 0, NULL,
1180
		NULL, 0, 0);
1184
		NULL, 0, 0, NULL);
1181
	    NFSM_BUILD(tl, u_int32_t *, 4 * NFSX_UNSIGNED);
1185
	    NFSM_BUILD(tl, u_int32_t *, 4 * NFSX_UNSIGNED);
1182
	    *tl++ = tsep->nfsess_clientid.lval[0];
1186
	    *tl++ = tsep->nfsess_clientid.lval[0];
1183
	    *tl++ = tsep->nfsess_clientid.lval[1];
1187
	    *tl++ = tsep->nfsess_clientid.lval[1];
Lines 1208-1214 nfsrpc_getattr(vnode_t vp, struct ucred *cred, NFSPROC Link Here
1208
	int error;
1212
	int error;
1209
	nfsattrbit_t attrbits;
1213
	nfsattrbit_t attrbits;
1210
1214
1211
	NFSCL_REQSTART(nd, NFSPROC_GETATTR, vp);
1215
	NFSCL_REQSTART(nd, NFSPROC_GETATTR, vp, cred);
1212
	if (nd->nd_flag & ND_NFSV4) {
1216
	if (nd->nd_flag & ND_NFSV4) {
1213
		NFSGETATTR_ATTRBIT(&attrbits);
1217
		NFSGETATTR_ATTRBIT(&attrbits);
1214
		(void) nfsrv_putattrbit(nd, &attrbits);
1218
		(void) nfsrv_putattrbit(nd, &attrbits);
Lines 1236-1242 nfsrpc_getattrnovp(struct nfsmount *nmp, u_int8_t *fhp Link Here
1236
	int error, vers = NFS_VER2;
1240
	int error, vers = NFS_VER2;
1237
	nfsattrbit_t attrbits;
1241
	nfsattrbit_t attrbits;
1238
1242
1239
	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);
1240
	if (nd->nd_flag & ND_NFSV4) {
1245
	if (nd->nd_flag & ND_NFSV4) {
1241
		vers = NFS_VER4;
1246
		vers = NFS_VER4;
1242
		NFSGETATTR_ATTRBIT(&attrbits);
1247
		NFSGETATTR_ATTRBIT(&attrbits);
Lines 1334-1341 nfsrpc_setattr(vnode_t vp, struct vattr *vap, NFSACL_T Link Here
1334
		    error == NFSERR_OLDSTATEID || error == NFSERR_BADSESSION) {
1339
		    error == NFSERR_OLDSTATEID || error == NFSERR_BADSESSION) {
1335
			(void) nfs_catnap(PZERO, error, "nfs_setattr");
1340
			(void) nfs_catnap(PZERO, error, "nfs_setattr");
1336
		} else if ((error == NFSERR_EXPIRED ||
1341
		} else if ((error == NFSERR_EXPIRED ||
1337
		    error == NFSERR_BADSTATEID) && clidrev != 0) {
1342
		    ((!NFSHASINT(nmp) || !NFSHASNFSV4N(nmp)) &&
1343
		    error == NFSERR_BADSTATEID)) && clidrev != 0) {
1338
			expireret = nfscl_hasexpired(nmp->nm_clp, clidrev, p);
1344
			expireret = nfscl_hasexpired(nmp->nm_clp, clidrev, p);
1345
		} else if (error == NFSERR_BADSTATEID && NFSHASINT(nmp) &&
1346
		    NFSHASNFSV4N(nmp)) {
1347
			error = EIO;
1339
		}
1348
		}
1340
		retrycnt++;
1349
		retrycnt++;
1341
	} while (error == NFSERR_GRACE || error == NFSERR_STALESTATEID ||
1350
	} while (error == NFSERR_GRACE || error == NFSERR_STALESTATEID ||
Lines 1362-1368 nfsrpc_setattrrpc(vnode_t vp, struct vattr *vap, Link Here
1362
	nfsattrbit_t attrbits;
1371
	nfsattrbit_t attrbits;
1363
1372
1364
	*attrflagp = 0;
1373
	*attrflagp = 0;
1365
	NFSCL_REQSTART(nd, NFSPROC_SETATTR, vp);
1374
	NFSCL_REQSTART(nd, NFSPROC_SETATTR, vp, cred);
1366
	if (nd->nd_flag & ND_NFSV4)
1375
	if (nd->nd_flag & ND_NFSV4)
1367
		nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSTATEID);
1376
		nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSTATEID);
1368
	vap->va_type = vnode_vtype(vp);
1377
	vap->va_type = vnode_vtype(vp);
Lines 1430-1438 nfsrpc_lookup(vnode_t dvp, char *name, int len, struct Link Here
1430
	if (NFSHASNFSV4(nmp) && len == 2 &&
1439
	if (NFSHASNFSV4(nmp) && len == 2 &&
1431
		name[0] == '.' && name[1] == '.') {
1440
		name[0] == '.' && name[1] == '.') {
1432
		lookupp = 1;
1441
		lookupp = 1;
1433
		NFSCL_REQSTART(nd, NFSPROC_LOOKUPP, dvp);
1442
		NFSCL_REQSTART(nd, NFSPROC_LOOKUPP, dvp, cred);
1434
	} else {
1443
	} else {
1435
		NFSCL_REQSTART(nd, NFSPROC_LOOKUP, dvp);
1444
		NFSCL_REQSTART(nd, NFSPROC_LOOKUP, dvp, cred);
1436
		(void) nfsm_strtom(nd, name, len);
1445
		(void) nfsm_strtom(nd, name, len);
1437
	}
1446
	}
1438
	if (nd->nd_flag & ND_NFSV4) {
1447
	if (nd->nd_flag & ND_NFSV4) {
Lines 1508-1514 nfsrpc_readlink(vnode_t vp, struct uio *uiop, struct u Link Here
1508
	int error, len, cangetattr = 1;
1517
	int error, len, cangetattr = 1;
1509
1518
1510
	*attrflagp = 0;
1519
	*attrflagp = 0;
1511
	NFSCL_REQSTART(nd, NFSPROC_READLINK, vp);
1520
	NFSCL_REQSTART(nd, NFSPROC_READLINK, vp, cred);
1512
	if (nd->nd_flag & ND_NFSV4) {
1521
	if (nd->nd_flag & ND_NFSV4) {
1513
		/*
1522
		/*
1514
		 * And do a Getattr op.
1523
		 * And do a Getattr op.
Lines 1596-1603 nfsrpc_read(vnode_t vp, struct uio *uiop, struct ucred Link Here
1596
		    error == NFSERR_OLDSTATEID || error == NFSERR_BADSESSION) {
1605
		    error == NFSERR_OLDSTATEID || error == NFSERR_BADSESSION) {
1597
			(void) nfs_catnap(PZERO, error, "nfs_read");
1606
			(void) nfs_catnap(PZERO, error, "nfs_read");
1598
		} else if ((error == NFSERR_EXPIRED ||
1607
		} else if ((error == NFSERR_EXPIRED ||
1599
		    error == NFSERR_BADSTATEID) && clidrev != 0) {
1608
		    ((!NFSHASINT(nmp) || !NFSHASNFSV4N(nmp)) &&
1609
		    error == NFSERR_BADSTATEID)) && clidrev != 0) {
1600
			expireret = nfscl_hasexpired(nmp->nm_clp, clidrev, p);
1610
			expireret = nfscl_hasexpired(nmp->nm_clp, clidrev, p);
1611
		} else if (error == NFSERR_BADSTATEID && NFSHASINT(nmp) &&
1612
		    NFSHASNFSV4N(nmp)) {
1613
			error = EIO;
1601
		}
1614
		}
1602
		retrycnt++;
1615
		retrycnt++;
1603
	} while (error == NFSERR_GRACE || error == NFSERR_STALESTATEID ||
1616
	} while (error == NFSERR_GRACE || error == NFSERR_STALESTATEID ||
Lines 1644-1650 nfsrpc_readrpc(vnode_t vp, struct uio *uiop, struct uc Link Here
1644
	while (tsiz > 0) {
1657
	while (tsiz > 0) {
1645
		*attrflagp = 0;
1658
		*attrflagp = 0;
1646
		len = (tsiz > rsize) ? rsize : tsiz;
1659
		len = (tsiz > rsize) ? rsize : tsiz;
1647
		NFSCL_REQSTART(nd, NFSPROC_READ, vp);
1660
		NFSCL_REQSTART(nd, NFSPROC_READ, vp, cred);
1648
		if (nd->nd_flag & ND_NFSV4)
1661
		if (nd->nd_flag & ND_NFSV4)
1649
			nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSTATEID);
1662
			nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSTATEID);
1650
		NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED * 3);
1663
		NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED * 3);
Lines 1768-1775 nfsrpc_write(vnode_t vp, struct uio *uiop, int *iomode Link Here
1768
		    error == NFSERR_OLDSTATEID || error == NFSERR_BADSESSION) {
1781
		    error == NFSERR_OLDSTATEID || error == NFSERR_BADSESSION) {
1769
			(void) nfs_catnap(PZERO, error, "nfs_write");
1782
			(void) nfs_catnap(PZERO, error, "nfs_write");
1770
		} else if ((error == NFSERR_EXPIRED ||
1783
		} else if ((error == NFSERR_EXPIRED ||
1771
		    error == NFSERR_BADSTATEID) && clidrev != 0) {
1784
		    ((!NFSHASINT(nmp) || !NFSHASNFSV4N(nmp)) &&
1785
		    error == NFSERR_BADSTATEID)) && clidrev != 0) {
1772
			expireret = nfscl_hasexpired(nmp->nm_clp, clidrev, p);
1786
			expireret = nfscl_hasexpired(nmp->nm_clp, clidrev, p);
1787
		} else if (error == NFSERR_BADSTATEID && NFSHASINT(nmp) &&
1788
		    NFSHASNFSV4N(nmp)) {
1789
			error = EIO;
1773
		}
1790
		}
1774
		retrycnt++;
1791
		retrycnt++;
1775
	} while (error == NFSERR_GRACE || error == NFSERR_DELAY ||
1792
	} while (error == NFSERR_GRACE || error == NFSERR_DELAY ||
Lines 1828-1836 nfsrpc_writerpc(vnode_t vp, struct uio *uiop, int *iom Link Here
1828
		*attrflagp = 0;
1845
		*attrflagp = 0;
1829
		len = (tsiz > wsize) ? wsize : tsiz;
1846
		len = (tsiz > wsize) ? wsize : tsiz;
1830
		if (do_append)
1847
		if (do_append)
1831
			NFSCL_REQSTART(nd, NFSPROC_APPENDWRITE, vp);
1848
			NFSCL_REQSTART(nd, NFSPROC_APPENDWRITE, vp, cred);
1832
		else
1849
		else
1833
			NFSCL_REQSTART(nd, NFSPROC_WRITE, vp);
1850
			NFSCL_REQSTART(nd, NFSPROC_WRITE, vp, cred);
1834
		if (nd->nd_flag & ND_NFSV4) {
1851
		if (nd->nd_flag & ND_NFSV4) {
1835
			if (do_append) {
1852
			if (do_append) {
1836
				NFSZERO_ATTRBIT(&attrbits);
1853
				NFSZERO_ATTRBIT(&attrbits);
Lines 2035-2041 nfsrpc_mknod(vnode_t dvp, char *name, int namelen, str Link Here
2035
	*dattrflagp = 0;
2052
	*dattrflagp = 0;
2036
	if (namelen > NFS_MAXNAMLEN)
2053
	if (namelen > NFS_MAXNAMLEN)
2037
		return (ENAMETOOLONG);
2054
		return (ENAMETOOLONG);
2038
	NFSCL_REQSTART(nd, NFSPROC_MKNOD, dvp);
2055
	NFSCL_REQSTART(nd, NFSPROC_MKNOD, dvp, cred);
2039
	if (nd->nd_flag & ND_NFSV4) {
2056
	if (nd->nd_flag & ND_NFSV4) {
2040
		if (vtyp == VBLK || vtyp == VCHR) {
2057
		if (vtyp == VBLK || vtyp == VCHR) {
2041
			NFSM_BUILD(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
2058
			NFSM_BUILD(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
Lines 2185-2191 nfsrpc_createv23(vnode_t dvp, char *name, int namelen, Link Here
2185
	*dattrflagp = 0;
2202
	*dattrflagp = 0;
2186
	if (namelen > NFS_MAXNAMLEN)
2203
	if (namelen > NFS_MAXNAMLEN)
2187
		return (ENAMETOOLONG);
2204
		return (ENAMETOOLONG);
2188
	NFSCL_REQSTART(nd, NFSPROC_CREATE, dvp);
2205
	NFSCL_REQSTART(nd, NFSPROC_CREATE, dvp, cred);
2189
	(void) nfsm_strtom(nd, name, namelen);
2206
	(void) nfsm_strtom(nd, name, namelen);
2190
	if (nd->nd_flag & ND_NFSV3) {
2207
	if (nd->nd_flag & ND_NFSV3) {
2191
		NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
2208
		NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
Lines 2247-2253 nfsrpc_createv4(vnode_t dvp, char *name, int namelen, Link Here
2247
	*dattrflagp = 0;
2264
	*dattrflagp = 0;
2248
	if (namelen > NFS_MAXNAMLEN)
2265
	if (namelen > NFS_MAXNAMLEN)
2249
		return (ENAMETOOLONG);
2266
		return (ENAMETOOLONG);
2250
	NFSCL_REQSTART(nd, NFSPROC_CREATE, dvp);
2267
	NFSCL_REQSTART(nd, NFSPROC_CREATE, dvp, cred);
2251
	/*
2268
	/*
2252
	 * For V4, this is actually an Open op.
2269
	 * For V4, this is actually an Open op.
2253
	 */
2270
	 */
Lines 2488-2494 tryagain: Link Here
2488
	if (NFSHASNFSV4(nmp) && ret == 0) {
2505
	if (NFSHASNFSV4(nmp) && ret == 0) {
2489
		ret = nfscl_removedeleg(vp, p, &dstateid);
2506
		ret = nfscl_removedeleg(vp, p, &dstateid);
2490
		if (ret == 1) {
2507
		if (ret == 1) {
2491
			NFSCL_REQSTART(nd, NFSPROC_RETDELEGREMOVE, vp);
2508
			NFSCL_REQSTART(nd, NFSPROC_RETDELEGREMOVE, vp, cred);
2492
			NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID +
2509
			NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID +
2493
			    NFSX_UNSIGNED);
2510
			    NFSX_UNSIGNED);
2494
			if (NFSHASNFSV4N(nmp))
2511
			if (NFSHASNFSV4N(nmp))
Lines 2509-2515 tryagain: Link Here
2509
		ret = 0;
2526
		ret = 0;
2510
	}
2527
	}
2511
	if (ret == 0)
2528
	if (ret == 0)
2512
		NFSCL_REQSTART(nd, NFSPROC_REMOVE, dvp);
2529
		NFSCL_REQSTART(nd, NFSPROC_REMOVE, dvp, cred);
2513
	(void) nfsm_strtom(nd, name, namelen);
2530
	(void) nfsm_strtom(nd, name, namelen);
2514
	error = nfscl_request(nd, dvp, p, cred, dstuff);
2531
	error = nfscl_request(nd, dvp, p, cred, dstuff);
2515
	if (error)
2532
	if (error)
Lines 2569-2579 tryagain: Link Here
2569
		ret = nfscl_renamedeleg(fvp, &fdstateid, &gotfd, tvp,
2586
		ret = nfscl_renamedeleg(fvp, &fdstateid, &gotfd, tvp,
2570
		    &tdstateid, &gottd, p);
2587
		    &tdstateid, &gottd, p);
2571
		if (gotfd && gottd) {
2588
		if (gotfd && gottd) {
2572
			NFSCL_REQSTART(nd, NFSPROC_RETDELEGRENAME2, fvp);
2589
			NFSCL_REQSTART(nd, NFSPROC_RETDELEGRENAME2, fvp, cred);
2573
		} else if (gotfd) {
2590
		} else if (gotfd) {
2574
			NFSCL_REQSTART(nd, NFSPROC_RETDELEGRENAME1, fvp);
2591
			NFSCL_REQSTART(nd, NFSPROC_RETDELEGRENAME1, fvp, cred);
2575
		} else if (gottd) {
2592
		} else if (gottd) {
2576
			NFSCL_REQSTART(nd, NFSPROC_RETDELEGRENAME1, tvp);
2593
			NFSCL_REQSTART(nd, NFSPROC_RETDELEGRENAME1, tvp, cred);
2577
		}
2594
		}
2578
		if (gotfd) {
2595
		if (gotfd) {
2579
			NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID);
2596
			NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID);
Lines 2617-2623 tryagain: Link Here
2617
		ret = 0;
2634
		ret = 0;
2618
	}
2635
	}
2619
	if (ret == 0)
2636
	if (ret == 0)
2620
		NFSCL_REQSTART(nd, NFSPROC_RENAME, fdvp);
2637
		NFSCL_REQSTART(nd, NFSPROC_RENAME, fdvp, cred);
2621
	if (nd->nd_flag & ND_NFSV4) {
2638
	if (nd->nd_flag & ND_NFSV4) {
2622
		NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
2639
		NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
2623
		*tl = txdr_unsigned(NFSV4OP_GETATTR);
2640
		*tl = txdr_unsigned(NFSV4OP_GETATTR);
Lines 2716-2722 nfsrpc_link(vnode_t dvp, vnode_t vp, char *name, int n Link Here
2716
	*dattrflagp = 0;
2733
	*dattrflagp = 0;
2717
	if (namelen > NFS_MAXNAMLEN)
2734
	if (namelen > NFS_MAXNAMLEN)
2718
		return (ENAMETOOLONG);
2735
		return (ENAMETOOLONG);
2719
	NFSCL_REQSTART(nd, NFSPROC_LINK, vp);
2736
	NFSCL_REQSTART(nd, NFSPROC_LINK, vp, cred);
2720
	if (nd->nd_flag & ND_NFSV4) {
2737
	if (nd->nd_flag & ND_NFSV4) {
2721
		NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
2738
		NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
2722
		*tl = txdr_unsigned(NFSV4OP_PUTFH);
2739
		*tl = txdr_unsigned(NFSV4OP_PUTFH);
Lines 2783-2789 nfsrpc_symlink(vnode_t dvp, char *name, int namelen, c Link Here
2783
	slen = strlen(target);
2800
	slen = strlen(target);
2784
	if (slen > NFS_MAXPATHLEN || namelen > NFS_MAXNAMLEN)
2801
	if (slen > NFS_MAXPATHLEN || namelen > NFS_MAXNAMLEN)
2785
		return (ENAMETOOLONG);
2802
		return (ENAMETOOLONG);
2786
	NFSCL_REQSTART(nd, NFSPROC_SYMLINK, dvp);
2803
	NFSCL_REQSTART(nd, NFSPROC_SYMLINK, dvp, cred);
2787
	if (nd->nd_flag & ND_NFSV4) {
2804
	if (nd->nd_flag & ND_NFSV4) {
2788
		NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
2805
		NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
2789
		*tl = txdr_unsigned(NFLNK);
2806
		*tl = txdr_unsigned(NFLNK);
Lines 2846-2852 nfsrpc_mkdir(vnode_t dvp, char *name, int namelen, str Link Here
2846
	fhp = VTONFS(dvp)->n_fhp;
2863
	fhp = VTONFS(dvp)->n_fhp;
2847
	if (namelen > NFS_MAXNAMLEN)
2864
	if (namelen > NFS_MAXNAMLEN)
2848
		return (ENAMETOOLONG);
2865
		return (ENAMETOOLONG);
2849
	NFSCL_REQSTART(nd, NFSPROC_MKDIR, dvp);
2866
	NFSCL_REQSTART(nd, NFSPROC_MKDIR, dvp, cred);
2850
	if (nd->nd_flag & ND_NFSV4) {
2867
	if (nd->nd_flag & ND_NFSV4) {
2851
		NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
2868
		NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED);
2852
		*tl = txdr_unsigned(NFDIR);
2869
		*tl = txdr_unsigned(NFDIR);
Lines 2918-2924 nfsrpc_rmdir(vnode_t dvp, char *name, int namelen, str Link Here
2918
	*dattrflagp = 0;
2935
	*dattrflagp = 0;
2919
	if (namelen > NFS_MAXNAMLEN)
2936
	if (namelen > NFS_MAXNAMLEN)
2920
		return (ENAMETOOLONG);
2937
		return (ENAMETOOLONG);
2921
	NFSCL_REQSTART(nd, NFSPROC_RMDIR, dvp);
2938
	NFSCL_REQSTART(nd, NFSPROC_RMDIR, dvp, cred);
2922
	(void) nfsm_strtom(nd, name, namelen);
2939
	(void) nfsm_strtom(nd, name, namelen);
2923
	error = nfscl_request(nd, dvp, p, cred, dstuff);
2940
	error = nfscl_request(nd, dvp, p, cred, dstuff);
2924
	if (error)
2941
	if (error)
Lines 3035-3041 nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64 Link Here
3035
		 * Joy, oh joy. For V4 we get to hand craft '.' and '..'.
3052
		 * Joy, oh joy. For V4 we get to hand craft '.' and '..'.
3036
		 */
3053
		 */
3037
		if (uiop->uio_offset == 0) {
3054
		if (uiop->uio_offset == 0) {
3038
			NFSCL_REQSTART(nd, NFSPROC_LOOKUPP, vp);
3055
			NFSCL_REQSTART(nd, NFSPROC_LOOKUPP, vp, cred);
3039
			NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
3056
			NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
3040
			*tl++ = txdr_unsigned(NFSV4OP_GETFH);
3057
			*tl++ = txdr_unsigned(NFSV4OP_GETFH);
3041
			*tl = txdr_unsigned(NFSV4OP_GETATTR);
3058
			*tl = txdr_unsigned(NFSV4OP_GETATTR);
Lines 3152-3158 nfsrpc_readdir(vnode_t vp, struct uio *uiop, nfsuint64 Link Here
3152
	 */
3169
	 */
3153
	while (more_dirs && bigenough) {
3170
	while (more_dirs && bigenough) {
3154
		*attrflagp = 0;
3171
		*attrflagp = 0;
3155
		NFSCL_REQSTART(nd, NFSPROC_READDIR, vp);
3172
		NFSCL_REQSTART(nd, NFSPROC_READDIR, vp, cred);
3156
		if (nd->nd_flag & ND_NFSV2) {
3173
		if (nd->nd_flag & ND_NFSV2) {
3157
			NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
3174
			NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
3158
			*tl++ = cookie.lval[1];
3175
			*tl++ = cookie.lval[1];
Lines 3479-3485 nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsui Link Here
3479
		 * Joy, oh joy. For V4 we get to hand craft '.' and '..'.
3496
		 * Joy, oh joy. For V4 we get to hand craft '.' and '..'.
3480
		 */
3497
		 */
3481
		if (uiop->uio_offset == 0) {
3498
		if (uiop->uio_offset == 0) {
3482
			NFSCL_REQSTART(nd, NFSPROC_LOOKUPP, vp);
3499
			NFSCL_REQSTART(nd, NFSPROC_LOOKUPP, vp, cred);
3483
			NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
3500
			NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
3484
			*tl++ = txdr_unsigned(NFSV4OP_GETFH);
3501
			*tl++ = txdr_unsigned(NFSV4OP_GETFH);
3485
			*tl = txdr_unsigned(NFSV4OP_GETATTR);
3502
			*tl = txdr_unsigned(NFSV4OP_GETATTR);
Lines 3601-3607 nfsrpc_readdirplus(vnode_t vp, struct uio *uiop, nfsui Link Here
3601
	 */
3618
	 */
3602
	while (more_dirs && bigenough) {
3619
	while (more_dirs && bigenough) {
3603
		*attrflagp = 0;
3620
		*attrflagp = 0;
3604
		NFSCL_REQSTART(nd, NFSPROC_READDIRPLUS, vp);
3621
		NFSCL_REQSTART(nd, NFSPROC_READDIRPLUS, vp, cred);
3605
 		NFSM_BUILD(tl, u_int32_t *, 6 * NFSX_UNSIGNED);
3622
 		NFSM_BUILD(tl, u_int32_t *, 6 * NFSX_UNSIGNED);
3606
		*tl++ = cookie.lval[0];
3623
		*tl++ = cookie.lval[0];
3607
		*tl++ = cookie.lval[1];
3624
		*tl++ = cookie.lval[1];
Lines 3957-3963 nfsrpc_commit(vnode_t vp, u_quad_t offset, int cnt, st Link Here
3957
	struct nfsmount *nmp = VFSTONFS(vp->v_mount);
3974
	struct nfsmount *nmp = VFSTONFS(vp->v_mount);
3958
3975
3959
	*attrflagp = 0;
3976
	*attrflagp = 0;
3960
	NFSCL_REQSTART(nd, NFSPROC_COMMIT, vp);
3977
	NFSCL_REQSTART(nd, NFSPROC_COMMIT, vp, cred);
3961
	NFSM_BUILD(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
3978
	NFSM_BUILD(tl, u_int32_t *, 3 * NFSX_UNSIGNED);
3962
	txdr_hyper(offset, tl);
3979
	txdr_hyper(offset, tl);
3963
	tl += 2;
3980
	tl += 2;
Lines 4177-4183 nfsrpc_lockt(struct nfsrv_descript *nd, vnode_t vp, Link Here
4177
	struct nfsclsession *tsep;
4194
	struct nfsclsession *tsep;
4178
4195
4179
	nmp = VFSTONFS(vp->v_mount);
4196
	nmp = VFSTONFS(vp->v_mount);
4180
	NFSCL_REQSTART(nd, NFSPROC_LOCKT, vp);
4197
	NFSCL_REQSTART(nd, NFSPROC_LOCKT, vp, cred);
4181
	NFSM_BUILD(tl, u_int32_t *, 7 * NFSX_UNSIGNED);
4198
	NFSM_BUILD(tl, u_int32_t *, 7 * NFSX_UNSIGNED);
4182
	if (fl->l_type == F_RDLCK)
4199
	if (fl->l_type == F_RDLCK)
4183
		*tl++ = txdr_unsigned(NFSV4LOCKT_READ);
4200
		*tl++ = txdr_unsigned(NFSV4LOCKT_READ);
Lines 4248-4254 nfsrpc_locku(struct nfsrv_descript *nd, struct nfsmoun Link Here
4248
	int error;
4265
	int error;
4249
4266
4250
	nfscl_reqstart(nd, NFSPROC_LOCKU, nmp, lp->nfsl_open->nfso_fh,
4267
	nfscl_reqstart(nd, NFSPROC_LOCKU, nmp, lp->nfsl_open->nfso_fh,
4251
	    lp->nfsl_open->nfso_fhlen, NULL, NULL, 0, 0);
4268
	    lp->nfsl_open->nfso_fhlen, NULL, NULL, 0, 0, cred);
4252
	NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID + 6 * NFSX_UNSIGNED);
4269
	NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID + 6 * NFSX_UNSIGNED);
4253
	*tl++ = txdr_unsigned(type);
4270
	*tl++ = txdr_unsigned(type);
4254
	*tl = txdr_unsigned(lp->nfsl_seqid);
4271
	*tl = txdr_unsigned(lp->nfsl_seqid);
Lines 4300-4306 nfsrpc_lock(struct nfsrv_descript *nd, struct nfsmount Link Here
4300
	uint8_t own[NFSV4CL_LOCKNAMELEN + NFSX_V4FHMAX];
4317
	uint8_t own[NFSV4CL_LOCKNAMELEN + NFSX_V4FHMAX];
4301
	struct nfsclsession *tsep;
4318
	struct nfsclsession *tsep;
4302
4319
4303
	nfscl_reqstart(nd, NFSPROC_LOCK, nmp, nfhp, fhlen, NULL, NULL, 0, 0);
4320
	nfscl_reqstart(nd, NFSPROC_LOCK, nmp, nfhp, fhlen, NULL, NULL, 0, 0,
4321
	    cred);
4304
	NFSM_BUILD(tl, u_int32_t *, 7 * NFSX_UNSIGNED);
4322
	NFSM_BUILD(tl, u_int32_t *, 7 * NFSX_UNSIGNED);
4305
	if (type == F_RDLCK)
4323
	if (type == F_RDLCK)
4306
		*tl++ = txdr_unsigned(NFSV4LOCKT_READ);
4324
		*tl++ = txdr_unsigned(NFSV4LOCKT_READ);
Lines 4395-4401 nfsrpc_statfs(vnode_t vp, struct nfsstatfs *sbp, struc Link Here
4395
		/*
4413
		/*
4396
		 * For V4, you actually do a getattr.
4414
		 * For V4, you actually do a getattr.
4397
		 */
4415
		 */
4398
		NFSCL_REQSTART(nd, NFSPROC_GETATTR, vp);
4416
		NFSCL_REQSTART(nd, NFSPROC_GETATTR, vp, cred);
4399
		NFSSTATFS_GETATTRBIT(&attrbits);
4417
		NFSSTATFS_GETATTRBIT(&attrbits);
4400
		(void) nfsrv_putattrbit(nd, &attrbits);
4418
		(void) nfsrv_putattrbit(nd, &attrbits);
4401
		nd->nd_flag |= ND_USEGSSNAME;
4419
		nd->nd_flag |= ND_USEGSSNAME;
Lines 4418-4424 nfsrpc_statfs(vnode_t vp, struct nfsstatfs *sbp, struc Link Here
4418
		if (error)
4436
		if (error)
4419
			goto nfsmout;
4437
			goto nfsmout;
4420
	} else {
4438
	} else {
4421
		NFSCL_REQSTART(nd, NFSPROC_FSSTAT, vp);
4439
		NFSCL_REQSTART(nd, NFSPROC_FSSTAT, vp, NULL);
4422
		error = nfscl_request(nd, vp, p, cred, stuff);
4440
		error = nfscl_request(nd, vp, p, cred, stuff);
4423
		if (error)
4441
		if (error)
4424
			return (error);
4442
			return (error);
Lines 4474-4480 nfsrpc_pathconf(vnode_t vp, struct nfsv3_pathconf *pc, Link Here
4474
		/*
4492
		/*
4475
		 * For V4, you actually do a getattr.
4493
		 * For V4, you actually do a getattr.
4476
		 */
4494
		 */
4477
		NFSCL_REQSTART(nd, NFSPROC_GETATTR, vp);
4495
		NFSCL_REQSTART(nd, NFSPROC_GETATTR, vp, cred);
4478
		NFSPATHCONF_GETATTRBIT(&attrbits);
4496
		NFSPATHCONF_GETATTRBIT(&attrbits);
4479
		(void) nfsrv_putattrbit(nd, &attrbits);
4497
		(void) nfsrv_putattrbit(nd, &attrbits);
4480
		nd->nd_flag |= ND_USEGSSNAME;
4498
		nd->nd_flag |= ND_USEGSSNAME;
Lines 4491-4497 nfsrpc_pathconf(vnode_t vp, struct nfsv3_pathconf *pc, Link Here
4491
			error = nd->nd_repstat;
4509
			error = nd->nd_repstat;
4492
		}
4510
		}
4493
	} else {
4511
	} else {
4494
		NFSCL_REQSTART(nd, NFSPROC_PATHCONF, vp);
4512
		NFSCL_REQSTART(nd, NFSPROC_PATHCONF, vp, NULL);
4495
		error = nfscl_request(nd, vp, p, cred, stuff);
4513
		error = nfscl_request(nd, vp, p, cred, stuff);
4496
		if (error)
4514
		if (error)
4497
			return (error);
4515
			return (error);
Lines 4527-4533 nfsrpc_fsinfo(vnode_t vp, struct nfsfsinfo *fsp, struc Link Here
4527
	int error;
4545
	int error;
4528
4546
4529
	*attrflagp = 0;
4547
	*attrflagp = 0;
4530
	NFSCL_REQSTART(nd, NFSPROC_FSINFO, vp);
4548
	NFSCL_REQSTART(nd, NFSPROC_FSINFO, vp, NULL);
4531
	error = nfscl_request(nd, vp, p, cred, stuff);
4549
	error = nfscl_request(nd, vp, p, cred, stuff);
4532
	if (error)
4550
	if (error)
4533
		return (error);
4551
		return (error);
Lines 4574-4583 nfsrpc_renew(struct nfsclclient *clp, struct nfsclds * Link Here
4574
		return (0);
4592
		return (0);
4575
	if (dsp == NULL)
4593
	if (dsp == NULL)
4576
		nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL, NULL, 0,
4594
		nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL, NULL, 0,
4577
		    0);
4595
		    0, cred);
4578
	else
4596
	else
4579
		nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL,
4597
		nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL,
4580
		    &dsp->nfsclds_sess, 0, 0);
4598
		    &dsp->nfsclds_sess, 0, 0, NULL);
4581
	if (!NFSHASNFSV4N(nmp)) {
4599
	if (!NFSHASNFSV4N(nmp)) {
4582
		/* NFSv4.1 just uses a Sequence Op and not a Renew. */
4600
		/* NFSv4.1 just uses a Sequence Op and not a Renew. */
4583
		NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
4601
		NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
Lines 4624-4634 nfsrpc_rellockown(struct nfsmount *nmp, struct nfscllo Link Here
4624
	if (NFSHASNFSV4N(nmp)) {
4642
	if (NFSHASNFSV4N(nmp)) {
4625
		/* For NFSv4.1, do a FreeStateID. */
4643
		/* For NFSv4.1, do a FreeStateID. */
4626
		nfscl_reqstart(nd, NFSPROC_FREESTATEID, nmp, NULL, 0, NULL,
4644
		nfscl_reqstart(nd, NFSPROC_FREESTATEID, nmp, NULL, 0, NULL,
4627
		    NULL, 0, 0);
4645
		    NULL, 0, 0, cred);
4628
		nfsm_stateidtom(nd, &lp->nfsl_stateid, NFSSTATEID_PUTSTATEID);
4646
		nfsm_stateidtom(nd, &lp->nfsl_stateid, NFSSTATEID_PUTSTATEID);
4629
	} else {
4647
	} else {
4630
		nfscl_reqstart(nd, NFSPROC_RELEASELCKOWN, nmp, NULL, 0, NULL,
4648
		nfscl_reqstart(nd, NFSPROC_RELEASELCKOWN, nmp, NULL, 0, NULL,
4631
		    NULL, 0, 0);
4649
		    NULL, 0, 0, NULL);
4632
		NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
4650
		NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
4633
		tsep = nfsmnt_mdssession(nmp);
4651
		tsep = nfsmnt_mdssession(nmp);
4634
		*tl++ = tsep->nfsess_clientid.lval[0];
4652
		*tl++ = tsep->nfsess_clientid.lval[0];
Lines 4662-4668 nfsrpc_getdirpath(struct nfsmount *nmp, u_char *dirpat Link Here
4662
	u_int32_t *opcntp;
4680
	u_int32_t *opcntp;
4663
4681
4664
	nfscl_reqstart(nd, NFSPROC_PUTROOTFH, nmp, NULL, 0, &opcntp, NULL, 0,
4682
	nfscl_reqstart(nd, NFSPROC_PUTROOTFH, nmp, NULL, 0, &opcntp, NULL, 0,
4665
	    0);
4683
	    0, NULL);
4666
	cp = dirpath;
4684
	cp = dirpath;
4667
	cnt = 0;
4685
	cnt = 0;
4668
	do {
4686
	do {
Lines 4729-4735 nfsrpc_delegreturn(struct nfscldeleg *dp, struct ucred Link Here
4729
	int error;
4747
	int error;
4730
4748
4731
	nfscl_reqstart(nd, NFSPROC_DELEGRETURN, nmp, dp->nfsdl_fh,
4749
	nfscl_reqstart(nd, NFSPROC_DELEGRETURN, nmp, dp->nfsdl_fh,
4732
	    dp->nfsdl_fhlen, NULL, NULL, 0, 0);
4750
	    dp->nfsdl_fhlen, NULL, NULL, 0, 0, cred);
4733
	NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID);
4751
	NFSM_BUILD(tl, u_int32_t *, NFSX_STATEID);
4734
	if (NFSHASNFSV4N(nmp))
4752
	if (NFSHASNFSV4N(nmp))
4735
		*tl++ = 0;
4753
		*tl++ = 0;
Lines 4763-4769 nfsrpc_getacl(vnode_t vp, struct ucred *cred, NFSPROC_ Link Here
4763
4781
4764
	if (nfsrv_useacl == 0 || !NFSHASNFSV4(nmp))
4782
	if (nfsrv_useacl == 0 || !NFSHASNFSV4(nmp))
4765
		return (EOPNOTSUPP);
4783
		return (EOPNOTSUPP);
4766
	NFSCL_REQSTART(nd, NFSPROC_GETACL, vp);
4784
	NFSCL_REQSTART(nd, NFSPROC_GETACL, vp, cred);
4767
	NFSZERO_ATTRBIT(&attrbits);
4785
	NFSZERO_ATTRBIT(&attrbits);
4768
	NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_ACL);
4786
	NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_ACL);
4769
	(void) nfsrv_putattrbit(nd, &attrbits);
4787
	(void) nfsrv_putattrbit(nd, &attrbits);
Lines 4809-4815 nfsrpc_setaclrpc(vnode_t vp, struct ucred *cred, NFSPR Link Here
4809
4827
4810
	if (!NFSHASNFSV4(nmp))
4828
	if (!NFSHASNFSV4(nmp))
4811
		return (EOPNOTSUPP);
4829
		return (EOPNOTSUPP);
4812
	NFSCL_REQSTART(nd, NFSPROC_SETACL, vp);
4830
	NFSCL_REQSTART(nd, NFSPROC_SETACL, vp, cred);
4813
	nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSTATEID);
4831
	nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSTATEID);
4814
	NFSZERO_ATTRBIT(&attrbits);
4832
	NFSZERO_ATTRBIT(&attrbits);
4815
	NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_ACL);
4833
	NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_ACL);
Lines 4842-4848 nfsrpc_exchangeid(struct nfsmount *nmp, struct nfsclcl Link Here
4842
	if (minorvers == 0)
4860
	if (minorvers == 0)
4843
		minorvers = nmp->nm_minorvers;
4861
		minorvers = nmp->nm_minorvers;
4844
	nfscl_reqstart(nd, NFSPROC_EXCHANGEID, nmp, NULL, 0, NULL, NULL,
4862
	nfscl_reqstart(nd, NFSPROC_EXCHANGEID, nmp, NULL, 0, NULL, NULL,
4845
	    NFS_VER4, minorvers);
4863
	    NFS_VER4, minorvers, NULL);
4846
	NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED);
4864
	NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED);
4847
	*tl++ = txdr_unsigned(nfsboottime.tv_sec);	/* Client owner */
4865
	*tl++ = txdr_unsigned(nfsboottime.tv_sec);	/* Client owner */
4848
	*tl = txdr_unsigned(clp->nfsc_rev);
4866
	*tl = txdr_unsigned(clp->nfsc_rev);
Lines 4938-4944 nfsrpc_createsession(struct nfsmount *nmp, struct nfsc Link Here
4938
	else
4956
	else
4939
		minorvers = NFSV41_MINORVERSION;
4957
		minorvers = NFSV41_MINORVERSION;
4940
	nfscl_reqstart(nd, NFSPROC_CREATESESSION, nmp, NULL, 0, NULL, NULL,
4958
	nfscl_reqstart(nd, NFSPROC_CREATESESSION, nmp, NULL, 0, NULL, NULL,
4941
	    NFS_VER4, minorvers);
4959
	    NFS_VER4, minorvers, NULL);
4942
	NFSM_BUILD(tl, uint32_t *, 4 * NFSX_UNSIGNED);
4960
	NFSM_BUILD(tl, uint32_t *, 4 * NFSX_UNSIGNED);
4943
	*tl++ = sep->nfsess_clientid.lval[0];
4961
	*tl++ = sep->nfsess_clientid.lval[0];
4944
	*tl++ = sep->nfsess_clientid.lval[1];
4962
	*tl++ = sep->nfsess_clientid.lval[1];
Lines 5056-5089 nfsmout: Link Here
5056
}
5074
}
5057
5075
5058
/*
5076
/*
5059
 * Do the NFSv4.1 Destroy Session.
5060
 */
5061
int
5062
nfsrpc_destroysession(struct nfsmount *nmp, struct nfsclclient *clp,
5063
    struct ucred *cred, NFSPROC_T *p)
5064
{
5065
	uint32_t *tl;
5066
	struct nfsrv_descript nfsd;
5067
	struct nfsrv_descript *nd = &nfsd;
5068
	int error;
5069
	struct nfsclsession *tsep;
5070
5071
	nfscl_reqstart(nd, NFSPROC_DESTROYSESSION, nmp, NULL, 0, NULL, NULL, 0,
5072
	    0);
5073
	NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID);
5074
	tsep = nfsmnt_mdssession(nmp);
5075
	bcopy(tsep->nfsess_sessionid, tl, NFSX_V4SESSIONID);
5076
	nd->nd_flag |= ND_USEGSSNAME;
5077
	error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, NULL, p, cred,
5078
	    NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL);
5079
	if (error != 0)
5080
		return (error);
5081
	error = nd->nd_repstat;
5082
	m_freem(nd->nd_mrep);
5083
	return (error);
5084
}
5085
5086
/*
5087
 * Do the NFSv4.1 Destroy Client.
5077
 * Do the NFSv4.1 Destroy Client.
5088
 */
5078
 */
5089
int
5079
int
Lines 5097-5103 nfsrpc_destroyclient(struct nfsmount *nmp, struct nfsc Link Here
5097
	struct nfsclsession *tsep;
5087
	struct nfsclsession *tsep;
5098
5088
5099
	nfscl_reqstart(nd, NFSPROC_DESTROYCLIENT, nmp, NULL, 0, NULL, NULL, 0,
5089
	nfscl_reqstart(nd, NFSPROC_DESTROYCLIENT, nmp, NULL, 0, NULL, NULL, 0,
5100
	    0);
5090
	    0, NULL);
5101
	NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED);
5091
	NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED);
5102
	tsep = nfsmnt_mdssession(nmp);
5092
	tsep = nfsmnt_mdssession(nmp);
5103
	*tl++ = tsep->nfsess_clientid.lval[0];
5093
	*tl++ = tsep->nfsess_clientid.lval[0];
Lines 5126-5132 nfsrpc_layoutget(struct nfsmount *nmp, uint8_t *fhp, i Link Here
5126
	int error;
5116
	int error;
5127
5117
5128
	nfscl_reqstart(nd, NFSPROC_LAYOUTGET, nmp, fhp, fhlen, NULL, NULL, 0,
5118
	nfscl_reqstart(nd, NFSPROC_LAYOUTGET, nmp, fhp, fhlen, NULL, NULL, 0,
5129
	    0);
5119
	    0, cred);
5130
	nfsrv_setuplayoutget(nd, iomode, offset, len, minlen, stateidp,
5120
	nfsrv_setuplayoutget(nd, iomode, offset, len, minlen, stateidp,
5131
	    layouttype, layoutlen, 0);
5121
	    layouttype, layoutlen, 0);
5132
	nd->nd_flag |= ND_USEGSSNAME;
5122
	nd->nd_flag |= ND_USEGSSNAME;
Lines 5170-5176 nfsrpc_getdeviceinfo(struct nfsmount *nmp, uint8_t *de Link Here
5170
	ndi = NULL;
5160
	ndi = NULL;
5171
	gotdspp = NULL;
5161
	gotdspp = NULL;
5172
	nfscl_reqstart(nd, NFSPROC_GETDEVICEINFO, nmp, NULL, 0, NULL, NULL, 0,
5162
	nfscl_reqstart(nd, NFSPROC_GETDEVICEINFO, nmp, NULL, 0, NULL, NULL, 0,
5173
	    0);
5163
	    0, cred);
5174
	NFSM_BUILD(tl, uint32_t *, NFSX_V4DEVICEID + 3 * NFSX_UNSIGNED);
5164
	NFSM_BUILD(tl, uint32_t *, NFSX_V4DEVICEID + 3 * NFSX_UNSIGNED);
5175
	NFSBCOPY(deviceid, tl, NFSX_V4DEVICEID);
5165
	NFSBCOPY(deviceid, tl, NFSX_V4DEVICEID);
5176
	tl += (NFSX_V4DEVICEID / NFSX_UNSIGNED);
5166
	tl += (NFSX_V4DEVICEID / NFSX_UNSIGNED);
Lines 5391-5397 nfsrpc_layoutcommit(struct nfsmount *nmp, uint8_t *fh, Link Here
5391
	int error;
5381
	int error;
5392
5382
5393
	nfscl_reqstart(nd, NFSPROC_LAYOUTCOMMIT, nmp, fh, fhlen, NULL, NULL,
5383
	nfscl_reqstart(nd, NFSPROC_LAYOUTCOMMIT, nmp, fh, fhlen, NULL, NULL,
5394
	    0, 0);
5384
	    0, 0, cred);
5395
	NFSM_BUILD(tl, uint32_t *, 5 * NFSX_UNSIGNED + 3 * NFSX_HYPER +
5385
	NFSM_BUILD(tl, uint32_t *, 5 * NFSX_UNSIGNED + 3 * NFSX_HYPER +
5396
	    NFSX_STATEID);
5386
	    NFSX_STATEID);
5397
	txdr_hyper(off, tl);
5387
	txdr_hyper(off, tl);
Lines 5442-5448 nfsrpc_layoutreturn(struct nfsmount *nmp, uint8_t *fh, Link Here
5442
	int error;
5432
	int error;
5443
5433
5444
	nfscl_reqstart(nd, NFSPROC_LAYOUTRETURN, nmp, fh, fhlen, NULL, NULL,
5434
	nfscl_reqstart(nd, NFSPROC_LAYOUTRETURN, nmp, fh, fhlen, NULL, NULL,
5445
	    0, 0);
5435
	    0, 0, cred);
5446
	NFSM_BUILD(tl, uint32_t *, 4 * NFSX_UNSIGNED);
5436
	NFSM_BUILD(tl, uint32_t *, 4 * NFSX_UNSIGNED);
5447
	if (reclaim != 0)
5437
	if (reclaim != 0)
5448
		*tl++ = newnfs_true;
5438
		*tl++ = newnfs_true;
Lines 5528-5534 nfsrpc_layouterror(struct nfsmount *nmp, uint8_t *fh, Link Here
5528
	int error;
5518
	int error;
5529
5519
5530
	nfscl_reqstart(nd, NFSPROC_LAYOUTERROR, nmp, fh, fhlen, NULL, NULL,
5520
	nfscl_reqstart(nd, NFSPROC_LAYOUTERROR, nmp, fh, fhlen, NULL, NULL,
5531
	    0, 0);
5521
	    0, 0, cred);
5532
	NFSM_BUILD(tl, uint32_t *, 2 * NFSX_HYPER + NFSX_STATEID +
5522
	NFSM_BUILD(tl, uint32_t *, 2 * NFSX_HYPER + NFSX_STATEID +
5533
	    NFSX_V4DEVICEID + 3 * NFSX_UNSIGNED);
5523
	    NFSX_V4DEVICEID + 3 * NFSX_UNSIGNED);
5534
	txdr_hyper(offset, tl); tl += 2;
5524
	txdr_hyper(offset, tl); tl += 2;
Lines 5837-5843 nfsrpc_reclaimcomplete(struct nfsmount *nmp, struct uc Link Here
5837
	int error;
5827
	int error;
5838
5828
5839
	nfscl_reqstart(nd, NFSPROC_RECLAIMCOMPL, nmp, NULL, 0, NULL, NULL, 0,
5829
	nfscl_reqstart(nd, NFSPROC_RECLAIMCOMPL, nmp, NULL, 0, NULL, NULL, 0,
5840
	    0);
5830
	    0, cred);
5841
	NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED);
5831
	NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED);
5842
	*tl = newnfs_false;
5832
	*tl = newnfs_false;
5843
	nd->nd_flag |= ND_USEGSSNAME;
5833
	nd->nd_flag |= ND_USEGSSNAME;
Lines 5866-5871 nfscl_initsessionslots(struct nfsclsession *sep) Link Here
5866
	for (i = 0; i < 64; i++)
5856
	for (i = 0; i < 64; i++)
5867
		sep->nfsess_slotseq[i] = 0;
5857
		sep->nfsess_slotseq[i] = 0;
5868
	sep->nfsess_slots = 0;
5858
	sep->nfsess_slots = 0;
5859
	sep->nfsess_badslots = 0;
5869
}
5860
}
5870
5861
5871
/*
5862
/*
Lines 6460-6466 nfsrpc_readds(vnode_t vp, struct uio *uiop, nfsv4state Link Here
6460
	nd->nd_mrep = NULL;
6451
	nd->nd_mrep = NULL;
6461
	if (vers == 0 || vers == NFS_VER4) {
6452
	if (vers == 0 || vers == NFS_VER4) {
6462
		nfscl_reqstart(nd, NFSPROC_READDS, nmp, fhp->nfh_fh,
6453
		nfscl_reqstart(nd, NFSPROC_READDS, nmp, fhp->nfh_fh,
6463
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers);
6454
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers,
6455
		    NULL);
6464
		vers = NFS_VER4;
6456
		vers = NFS_VER4;
6465
		NFSCL_DEBUG(4, "nfsrpc_readds: vers4 minvers=%d\n", minorvers);
6457
		NFSCL_DEBUG(4, "nfsrpc_readds: vers4 minvers=%d\n", minorvers);
6466
		if (flex != 0)
6458
		if (flex != 0)
Lines 6469-6475 nfsrpc_readds(vnode_t vp, struct uio *uiop, nfsv4state Link Here
6469
			nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSEQIDZERO);
6461
			nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSEQIDZERO);
6470
	} else {
6462
	} else {
6471
		nfscl_reqstart(nd, NFSPROC_READ, nmp, fhp->nfh_fh,
6463
		nfscl_reqstart(nd, NFSPROC_READ, nmp, fhp->nfh_fh,
6472
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers);
6464
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers,
6465
		    NULL);
6473
		NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_READ]);
6466
		NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_READ]);
6474
		NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_READDS]);
6467
		NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_READDS]);
6475
		NFSCL_DEBUG(4, "nfsrpc_readds: vers3\n");
6468
		NFSCL_DEBUG(4, "nfsrpc_readds: vers3\n");
Lines 6536-6542 nfsrpc_writeds(vnode_t vp, struct uio *uiop, int *iomo Link Here
6536
	nd->nd_mrep = NULL;
6529
	nd->nd_mrep = NULL;
6537
	if (vers == 0 || vers == NFS_VER4) {
6530
	if (vers == 0 || vers == NFS_VER4) {
6538
		nfscl_reqstart(nd, NFSPROC_WRITEDS, nmp, fhp->nfh_fh,
6531
		nfscl_reqstart(nd, NFSPROC_WRITEDS, nmp, fhp->nfh_fh,
6539
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers);
6532
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers,
6533
		    NULL);
6540
		NFSCL_DEBUG(4, "nfsrpc_writeds: vers4 minvers=%d\n", minorvers);
6534
		NFSCL_DEBUG(4, "nfsrpc_writeds: vers4 minvers=%d\n", minorvers);
6541
		vers = NFS_VER4;
6535
		vers = NFS_VER4;
6542
		if (flex != 0)
6536
		if (flex != 0)
Lines 6546-6552 nfsrpc_writeds(vnode_t vp, struct uio *uiop, int *iomo Link Here
6546
		NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + 2 * NFSX_UNSIGNED);
6540
		NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + 2 * NFSX_UNSIGNED);
6547
	} else {
6541
	} else {
6548
		nfscl_reqstart(nd, NFSPROC_WRITE, nmp, fhp->nfh_fh,
6542
		nfscl_reqstart(nd, NFSPROC_WRITE, nmp, fhp->nfh_fh,
6549
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers);
6543
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers,
6544
		    NULL);
6550
		NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITE]);
6545
		NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITE]);
6551
		NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITEDS]);
6546
		NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITEDS]);
6552
		NFSCL_DEBUG(4, "nfsrpc_writeds: vers3\n");
6547
		NFSCL_DEBUG(4, "nfsrpc_writeds: vers3\n");
Lines 6669-6675 nfsrpc_writedsmir(vnode_t vp, int *iomode, int *must_c Link Here
6669
	nd->nd_mrep = NULL;
6664
	nd->nd_mrep = NULL;
6670
	if (vers == 0 || vers == NFS_VER4) {
6665
	if (vers == 0 || vers == NFS_VER4) {
6671
		nfscl_reqstart(nd, NFSPROC_WRITEDS, nmp, fhp->nfh_fh,
6666
		nfscl_reqstart(nd, NFSPROC_WRITEDS, nmp, fhp->nfh_fh,
6672
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers);
6667
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers,
6668
		    NULL);
6673
		vers = NFS_VER4;
6669
		vers = NFS_VER4;
6674
		NFSCL_DEBUG(4, "nfsrpc_writedsmir: vers4 minvers=%d\n",
6670
		NFSCL_DEBUG(4, "nfsrpc_writedsmir: vers4 minvers=%d\n",
6675
		    minorvers);
6671
		    minorvers);
Lines 6677-6683 nfsrpc_writedsmir(vnode_t vp, int *iomode, int *must_c Link Here
6677
		NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + 2 * NFSX_UNSIGNED);
6673
		NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + 2 * NFSX_UNSIGNED);
6678
	} else {
6674
	} else {
6679
		nfscl_reqstart(nd, NFSPROC_WRITE, nmp, fhp->nfh_fh,
6675
		nfscl_reqstart(nd, NFSPROC_WRITE, nmp, fhp->nfh_fh,
6680
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers);
6676
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers,
6677
		    NULL);
6681
		NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITE]);
6678
		NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITE]);
6682
		NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITEDS]);
6679
		NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITEDS]);
6683
		NFSCL_DEBUG(4, "nfsrpc_writedsmir: vers3\n");
6680
		NFSCL_DEBUG(4, "nfsrpc_writedsmir: vers3\n");
Lines 6897-6907 nfsrpc_commitds(vnode_t vp, uint64_t offset, int cnt, Link Here
6897
	nd->nd_mrep = NULL;
6894
	nd->nd_mrep = NULL;
6898
	if (vers == 0 || vers == NFS_VER4) {
6895
	if (vers == 0 || vers == NFS_VER4) {
6899
		nfscl_reqstart(nd, NFSPROC_COMMITDS, nmp, fhp->nfh_fh,
6896
		nfscl_reqstart(nd, NFSPROC_COMMITDS, nmp, fhp->nfh_fh,
6900
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers);
6897
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers,
6898
		    NULL);
6901
		vers = NFS_VER4;
6899
		vers = NFS_VER4;
6902
	} else {
6900
	} else {
6903
		nfscl_reqstart(nd, NFSPROC_COMMIT, nmp, fhp->nfh_fh,
6901
		nfscl_reqstart(nd, NFSPROC_COMMIT, nmp, fhp->nfh_fh,
6904
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers);
6902
		    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers,
6903
		    NULL);
6905
		NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_COMMIT]);
6904
		NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_COMMIT]);
6906
		NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_COMMITDS]);
6905
		NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_COMMITDS]);
6907
	}
6906
	}
Lines 7016-7022 nfsrpc_advise(vnode_t vp, off_t offset, uint64_t cnt, Link Here
7016
		NFSSETBIT_ATTRBIT(&hints, NFSV4IOHINT_DONTNEED);
7015
		NFSSETBIT_ATTRBIT(&hints, NFSV4IOHINT_DONTNEED);
7017
	else
7016
	else
7018
		return (0);
7017
		return (0);
7019
	NFSCL_REQSTART(nd, NFSPROC_IOADVISE, vp);
7018
	NFSCL_REQSTART(nd, NFSPROC_IOADVISE, vp, cred);
7020
	nfsm_stateidtom(nd, NULL, NFSSTATEID_PUTALLZERO);
7019
	nfsm_stateidtom(nd, NULL, NFSSTATEID_PUTALLZERO);
7021
	NFSM_BUILD(tl, uint32_t *, 2 * NFSX_HYPER);
7020
	NFSM_BUILD(tl, uint32_t *, 2 * NFSX_HYPER);
7022
	txdr_hyper(offset, tl);
7021
	txdr_hyper(offset, tl);
Lines 7060-7066 nfsrpc_adviseds(vnode_t vp, uint64_t offset, int cnt, Link Here
7060
		return (0);
7059
		return (0);
7061
	nd->nd_mrep = NULL;
7060
	nd->nd_mrep = NULL;
7062
	nfscl_reqstart(nd, NFSPROC_IOADVISEDS, nmp, fhp->nfh_fh,
7061
	nfscl_reqstart(nd, NFSPROC_IOADVISEDS, nmp, fhp->nfh_fh,
7063
	    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers);
7062
	    fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers, NULL);
7064
	vers = NFS_VER4;
7063
	vers = NFS_VER4;
7065
	NFSCL_DEBUG(4, "nfsrpc_adviseds: vers=%d minvers=%d\n", vers,
7064
	NFSCL_DEBUG(4, "nfsrpc_adviseds: vers=%d minvers=%d\n", vers,
7066
	    minorvers);
7065
	    minorvers);
Lines 7199-7207 nfsrpc_allocate(vnode_t vp, off_t off, off_t len, stru Link Here
7199
		    error == NFSERR_STALEDONTRECOVER || error == NFSERR_DELAY ||
7198
		    error == NFSERR_STALEDONTRECOVER || error == NFSERR_DELAY ||
7200
		    error == NFSERR_OLDSTATEID || error == NFSERR_BADSESSION) {
7199
		    error == NFSERR_OLDSTATEID || error == NFSERR_BADSESSION) {
7201
			(void) nfs_catnap(PZERO, error, "nfs_allocate");
7200
			(void) nfs_catnap(PZERO, error, "nfs_allocate");
7202
		} else if ((error == NFSERR_EXPIRED ||
7201
		} else if ((error == NFSERR_EXPIRED || (!NFSHASINT(nmp) &&
7203
		    error == NFSERR_BADSTATEID) && clidrev != 0) {
7202
		    error == NFSERR_BADSTATEID)) && clidrev != 0) {
7204
			expireret = nfscl_hasexpired(nmp->nm_clp, clidrev, p);
7203
			expireret = nfscl_hasexpired(nmp->nm_clp, clidrev, p);
7204
		} else if (error == NFSERR_BADSTATEID && NFSHASINT(nmp)) {
7205
			error = EIO;
7205
		}
7206
		}
7206
		retrycnt++;
7207
		retrycnt++;
7207
	} while (error == NFSERR_GRACE || error == NFSERR_DELAY ||
7208
	} while (error == NFSERR_GRACE || error == NFSERR_DELAY ||
Lines 7230-7236 nfsrpc_allocaterpc(vnode_t vp, off_t off, off_t len, n Link Here
7230
	nfsattrbit_t attrbits;
7231
	nfsattrbit_t attrbits;
7231
7232
7232
	*attrflagp = 0;
7233
	*attrflagp = 0;
7233
	NFSCL_REQSTART(nd, NFSPROC_ALLOCATE, vp);
7234
	NFSCL_REQSTART(nd, NFSPROC_ALLOCATE, vp, cred);
7234
	nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSTATEID);
7235
	nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSTATEID);
7235
	NFSM_BUILD(tl, uint32_t *, 2 * NFSX_HYPER + NFSX_UNSIGNED);
7236
	NFSM_BUILD(tl, uint32_t *, 2 * NFSX_HYPER + NFSX_UNSIGNED);
7236
	txdr_hyper(off, tl); tl += 2;
7237
	txdr_hyper(off, tl); tl += 2;
Lines 7718-7724 nfsrpc_openlayoutrpc(struct nfsmount *nmp, vnode_t vp, Link Here
7718
	*dpp = NULL;
7719
	*dpp = NULL;
7719
	*laystatp = ENXIO;
7720
	*laystatp = ENXIO;
7720
	nfscl_reqstart(nd, NFSPROC_OPENLAYGET, nmp, nfhp, fhlen, NULL, NULL,
7721
	nfscl_reqstart(nd, NFSPROC_OPENLAYGET, nmp, nfhp, fhlen, NULL, NULL,
7721
	    0, 0);
7722
	    0, 0, cred);
7722
	NFSM_BUILD(tl, uint32_t *, 5 * NFSX_UNSIGNED);
7723
	NFSM_BUILD(tl, uint32_t *, 5 * NFSX_UNSIGNED);
7723
	*tl++ = txdr_unsigned(op->nfso_own->nfsow_seqid);
7724
	*tl++ = txdr_unsigned(op->nfso_own->nfsow_seqid);
7724
	*tl++ = txdr_unsigned(mode & NFSV4OPEN_ACCESSBOTH);
7725
	*tl++ = txdr_unsigned(mode & NFSV4OPEN_ACCESSBOTH);
Lines 7903-7909 nfsrpc_createlayout(vnode_t dvp, char *name, int namel Link Here
7903
	*dattrflagp = 0;
7904
	*dattrflagp = 0;
7904
	if (namelen > NFS_MAXNAMLEN)
7905
	if (namelen > NFS_MAXNAMLEN)
7905
		return (ENAMETOOLONG);
7906
		return (ENAMETOOLONG);
7906
	NFSCL_REQSTART(nd, NFSPROC_CREATELAYGET, dvp);
7907
	NFSCL_REQSTART(nd, NFSPROC_CREATELAYGET, dvp, cred);
7907
	/*
7908
	/*
7908
	 * For V4, this is actually an Open op.
7909
	 * For V4, this is actually an Open op.
7909
	 */
7910
	 */
Lines 8300-8309 nfsrpc_copy_file_range(vnode_t invp, off_t *inoffp, vn Link Here
8300
		    error == NFSERR_STALEDONTRECOVER || error == NFSERR_DELAY ||
8301
		    error == NFSERR_STALEDONTRECOVER || error == NFSERR_DELAY ||
8301
		    error == NFSERR_OLDSTATEID || error == NFSERR_BADSESSION) {
8302
		    error == NFSERR_OLDSTATEID || error == NFSERR_BADSESSION) {
8302
			(void) nfs_catnap(PZERO, error, "nfs_cfr");
8303
			(void) nfs_catnap(PZERO, error, "nfs_cfr");
8303
		} else if ((error == NFSERR_EXPIRED ||
8304
		} else if ((error == NFSERR_EXPIRED || (!NFSHASINT(nmp) &&
8304
		    error == NFSERR_BADSTATEID) && clidrev != 0) {
8305
		    error == NFSERR_BADSTATEID)) && clidrev != 0) {
8305
			expireret = nfscl_hasexpired(nmp->nm_clp, clidrev,
8306
			expireret = nfscl_hasexpired(nmp->nm_clp, clidrev,
8306
			    curthread);
8307
			    curthread);
8308
		} else if (error == NFSERR_BADSTATEID && NFSHASINT(nmp)) {
8309
			error = EIO;
8307
		}
8310
		}
8308
		retrycnt++;
8311
		retrycnt++;
8309
	} while (error == NFSERR_GRACE || error == NFSERR_DELAY ||
8312
	} while (error == NFSERR_GRACE || error == NFSERR_DELAY ||
Lines 8344-8350 nfsrpc_copyrpc(vnode_t invp, off_t inoff, vnode_t outv Link Here
8344
	*lenp = 0;
8347
	*lenp = 0;
8345
	if (len > nfs_maxcopyrange)
8348
	if (len > nfs_maxcopyrange)
8346
		len = nfs_maxcopyrange;
8349
		len = nfs_maxcopyrange;
8347
	NFSCL_REQSTART(nd, NFSPROC_COPY, invp);
8350
	NFSCL_REQSTART(nd, NFSPROC_COPY, invp, cred);
8348
	NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED);
8351
	NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED);
8349
	*tl = txdr_unsigned(NFSV4OP_GETATTR);
8352
	*tl = txdr_unsigned(NFSV4OP_GETATTR);
8350
	NFSGETATTR_ATTRBIT(&attrbits);
8353
	NFSGETATTR_ATTRBIT(&attrbits);
Lines 8477-8486 nfsrpc_seek(vnode_t vp, off_t *offp, bool *eofp, int c Link Here
8477
		    error == NFSERR_STALEDONTRECOVER || error == NFSERR_DELAY ||
8480
		    error == NFSERR_STALEDONTRECOVER || error == NFSERR_DELAY ||
8478
		    error == NFSERR_OLDSTATEID || error == NFSERR_BADSESSION) {
8481
		    error == NFSERR_OLDSTATEID || error == NFSERR_BADSESSION) {
8479
			(void) nfs_catnap(PZERO, error, "nfs_seek");
8482
			(void) nfs_catnap(PZERO, error, "nfs_seek");
8480
		} else if ((error == NFSERR_EXPIRED ||
8483
		} else if ((error == NFSERR_EXPIRED || (!NFSHASINT(nmp) &&
8481
		    error == NFSERR_BADSTATEID) && clidrev != 0) {
8484
		    error == NFSERR_BADSTATEID)) && clidrev != 0) {
8482
			expireret = nfscl_hasexpired(nmp->nm_clp, clidrev,
8485
			expireret = nfscl_hasexpired(nmp->nm_clp, clidrev,
8483
			    curthread);
8486
			    curthread);
8487
		} else if (error == NFSERR_BADSTATEID && NFSHASINT(nmp)) {
8488
			error = EIO;
8484
		}
8489
		}
8485
		retrycnt++;
8490
		retrycnt++;
8486
	} while (error == NFSERR_GRACE || error == NFSERR_STALESTATEID ||
8491
	} while (error == NFSERR_GRACE || error == NFSERR_STALESTATEID ||
Lines 8509-8515 nfsrpc_seekrpc(vnode_t vp, off_t *offp, nfsv4stateid_t Link Here
8509
	nfsattrbit_t attrbits;
8514
	nfsattrbit_t attrbits;
8510
8515
8511
	*attrflagp = 0;
8516
	*attrflagp = 0;
8512
	NFSCL_REQSTART(nd, NFSPROC_SEEK, vp);
8517
	NFSCL_REQSTART(nd, NFSPROC_SEEK, vp, cred);
8513
	nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSTATEID);
8518
	nfsm_stateidtom(nd, stateidp, NFSSTATEID_PUTSTATEID);
8514
	NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + 2 * NFSX_UNSIGNED);
8519
	NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + 2 * NFSX_UNSIGNED);
8515
	txdr_hyper(*offp, tl); tl += 2;
8520
	txdr_hyper(*offp, tl); tl += 2;
Lines 8553-8559 nfsrpc_getextattr(vnode_t vp, const char *name, struct Link Here
8553
	uint32_t len, len2;
8558
	uint32_t len, len2;
8554
8559
8555
	*attrflagp = 0;
8560
	*attrflagp = 0;
8556
	NFSCL_REQSTART(nd, NFSPROC_GETEXTATTR, vp);
8561
	NFSCL_REQSTART(nd, NFSPROC_GETEXTATTR, vp, cred);
8557
	nfsm_strtom(nd, name, strlen(name));
8562
	nfsm_strtom(nd, name, strlen(name));
8558
	NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED);
8563
	NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED);
8559
	*tl = txdr_unsigned(NFSV4OP_GETATTR);
8564
	*tl = txdr_unsigned(NFSV4OP_GETATTR);
Lines 8623-8629 nfsrpc_setextattr(vnode_t vp, const char *name, struct Link Here
8623
	nfsattrbit_t attrbits;
8628
	nfsattrbit_t attrbits;
8624
8629
8625
	*attrflagp = 0;
8630
	*attrflagp = 0;
8626
	NFSCL_REQSTART(nd, NFSPROC_SETEXTATTR, vp);
8631
	NFSCL_REQSTART(nd, NFSPROC_SETEXTATTR, vp, cred);
8627
	if (uiop->uio_resid > nd->nd_maxreq) {
8632
	if (uiop->uio_resid > nd->nd_maxreq) {
8628
		/* nd_maxreq is set by NFSCL_REQSTART(). */
8633
		/* nd_maxreq is set by NFSCL_REQSTART(). */
8629
		m_freem(nd->nd_mreq);
8634
		m_freem(nd->nd_mreq);
Lines 8671-8677 nfsrpc_rmextattr(vnode_t vp, const char *name, struct Link Here
8671
	nfsattrbit_t attrbits;
8676
	nfsattrbit_t attrbits;
8672
8677
8673
	*attrflagp = 0;
8678
	*attrflagp = 0;
8674
	NFSCL_REQSTART(nd, NFSPROC_RMEXTATTR, vp);
8679
	NFSCL_REQSTART(nd, NFSPROC_RMEXTATTR, vp, cred);
8675
	nfsm_strtom(nd, name, strlen(name));
8680
	nfsm_strtom(nd, name, strlen(name));
8676
	NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED);
8681
	NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED);
8677
	*tl = txdr_unsigned(NFSV4OP_GETATTR);
8682
	*tl = txdr_unsigned(NFSV4OP_GETATTR);
Lines 8711-8717 nfsrpc_listextattr(vnode_t vp, uint64_t *cookiep, stru Link Here
8711
	u_char c;
8716
	u_char c;
8712
8717
8713
	*attrflagp = 0;
8718
	*attrflagp = 0;
8714
	NFSCL_REQSTART(nd, NFSPROC_LISTEXTATTR, vp);
8719
	NFSCL_REQSTART(nd, NFSPROC_LISTEXTATTR, vp, cred);
8715
	NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + 2 * NFSX_UNSIGNED);
8720
	NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + 2 * NFSX_UNSIGNED);
8716
	txdr_hyper(*cookiep, tl); tl += 2;
8721
	txdr_hyper(*cookiep, tl); tl += 2;
8717
	*tl++ = txdr_unsigned(*lenp);
8722
	*tl++ = txdr_unsigned(*lenp);
Lines 8885-8891 nfsrpc_bindconnsess(CLIENT *cl, void *arg, struct ucre Link Here
8885
	int error;
8890
	int error;
8886
8891
8887
	nfscl_reqstart(nd, NFSPROC_BINDCONNTOSESS, NULL, NULL, 0, NULL, NULL,
8892
	nfscl_reqstart(nd, NFSPROC_BINDCONNTOSESS, NULL, NULL, 0, NULL, NULL,
8888
	    NFS_VER4, rcp->minorvers);
8893
	    NFS_VER4, rcp->minorvers, NULL);
8889
	NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID + 2 * NFSX_UNSIGNED);
8894
	NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID + 2 * NFSX_UNSIGNED);
8890
	memcpy(tl, rcp->sessionid, NFSX_V4SESSIONID);
8895
	memcpy(tl, rcp->sessionid, NFSX_V4SESSIONID);
8891
	tl += NFSX_V4SESSIONID / NFSX_UNSIGNED;
8896
	tl += NFSX_V4SESSIONID / NFSX_UNSIGNED;
(-)sys/fs/nfsclient/nfs_clstate.c (-1 / +1 lines)
Lines 2089-2095 nfscl_umount(struct nfsmount *nmp, NFSPROC_T *p, struc Link Here
2089
		nfscl_delegreturnall(clp, p, dhp);
2089
		nfscl_delegreturnall(clp, p, dhp);
2090
		cred = newnfs_getcred();
2090
		cred = newnfs_getcred();
2091
		if (NFSHASNFSV4N(nmp)) {
2091
		if (NFSHASNFSV4N(nmp)) {
2092
			(void)nfsrpc_destroysession(nmp, clp, cred, p);
2092
			(void)nfsrpc_destroysession(nmp, NULL, cred, p);
2093
			(void)nfsrpc_destroyclient(nmp, clp, cred, p);
2093
			(void)nfsrpc_destroyclient(nmp, clp, cred, p);
2094
		} else
2094
		} else
2095
			(void)nfsrpc_setclient(nmp, clp, 0, NULL, cred, p);
2095
			(void)nfsrpc_setclient(nmp, clp, 0, NULL, cred, p);
(-)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 (-7 / +7 lines)
Lines 5235-5241 nfsrv_readdsrpc(fhandle_t *fhp, off_t off, int len, st Link Here
5235
	st.other[2] = 0x55555555;
5235
	st.other[2] = 0x55555555;
5236
	st.seqid = 0xffffffff;
5236
	st.seqid = 0xffffffff;
5237
	nfscl_reqstart(nd, NFSPROC_READDS, nmp, (u_int8_t *)fhp, sizeof(*fhp),
5237
	nfscl_reqstart(nd, NFSPROC_READDS, nmp, (u_int8_t *)fhp, sizeof(*fhp),
5238
	    NULL, NULL, 0, 0);
5238
	    NULL, NULL, 0, 0, cred);
5239
	nfsm_stateidtom(nd, &st, NFSSTATEID_PUTSTATEID);
5239
	nfsm_stateidtom(nd, &st, NFSSTATEID_PUTSTATEID);
5240
	NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED * 3);
5240
	NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED * 3);
5241
	txdr_hyper(off, tl);
5241
	txdr_hyper(off, tl);
Lines 5343-5349 nfsrv_writedsdorpc(struct nfsmount *nmp, fhandle_t *fh Link Here
5343
5343
5344
	nd = malloc(sizeof(*nd), M_TEMP, M_WAITOK | M_ZERO);
5344
	nd = malloc(sizeof(*nd), M_TEMP, M_WAITOK | M_ZERO);
5345
	nfscl_reqstart(nd, NFSPROC_WRITE, nmp, (u_int8_t *)fhp,
5345
	nfscl_reqstart(nd, NFSPROC_WRITE, nmp, (u_int8_t *)fhp,
5346
	    sizeof(fhandle_t), NULL, NULL, 0, 0);
5346
	    sizeof(fhandle_t), NULL, NULL, 0, 0, cred);
5347
5347
5348
	/*
5348
	/*
5349
	 * Use a stateid where other is an alternating 01010 pattern and
5349
	 * Use a stateid where other is an alternating 01010 pattern and
Lines 5565-5571 nfsrv_allocatedsdorpc(struct nfsmount *nmp, fhandle_t Link Here
5565
5565
5566
	nd = malloc(sizeof(*nd), M_TEMP, M_WAITOK | M_ZERO);
5566
	nd = malloc(sizeof(*nd), M_TEMP, M_WAITOK | M_ZERO);
5567
	nfscl_reqstart(nd, NFSPROC_ALLOCATE, nmp, (u_int8_t *)fhp,
5567
	nfscl_reqstart(nd, NFSPROC_ALLOCATE, nmp, (u_int8_t *)fhp,
5568
	    sizeof(fhandle_t), NULL, NULL, 0, 0);
5568
	    sizeof(fhandle_t), NULL, NULL, 0, 0, cred);
5569
5569
5570
	/*
5570
	/*
5571
	 * Use a stateid where other is an alternating 01010 pattern and
5571
	 * Use a stateid where other is an alternating 01010 pattern and
Lines 5719-5725 nfsrv_setattrdsdorpc(fhandle_t *fhp, struct ucred *cre Link Here
5719
	st.other[2] = 0x55555555;
5719
	st.other[2] = 0x55555555;
5720
	st.seqid = 0xffffffff;
5720
	st.seqid = 0xffffffff;
5721
	nfscl_reqstart(nd, NFSPROC_SETATTR, nmp, (u_int8_t *)fhp, sizeof(*fhp),
5721
	nfscl_reqstart(nd, NFSPROC_SETATTR, nmp, (u_int8_t *)fhp, sizeof(*fhp),
5722
	    NULL, NULL, 0, 0);
5722
	    NULL, NULL, 0, 0, cred);
5723
	nfsm_stateidtom(nd, &st, NFSSTATEID_PUTSTATEID);
5723
	nfsm_stateidtom(nd, &st, NFSSTATEID_PUTSTATEID);
5724
	nfscl_fillsattr(nd, &nap->na_vattr, vp, NFSSATTR_FULL, 0);
5724
	nfscl_fillsattr(nd, &nap->na_vattr, vp, NFSSATTR_FULL, 0);
5725
5725
Lines 5904-5910 nfsrv_setacldsdorpc(fhandle_t *fhp, struct ucred *cred Link Here
5904
	st.other[2] = 0x55555555;
5904
	st.other[2] = 0x55555555;
5905
	st.seqid = 0xffffffff;
5905
	st.seqid = 0xffffffff;
5906
	nfscl_reqstart(nd, NFSPROC_SETACL, nmp, (u_int8_t *)fhp, sizeof(*fhp),
5906
	nfscl_reqstart(nd, NFSPROC_SETACL, nmp, (u_int8_t *)fhp, sizeof(*fhp),
5907
	    NULL, NULL, 0, 0);
5907
	    NULL, NULL, 0, 0, cred);
5908
	nfsm_stateidtom(nd, &st, NFSSTATEID_PUTSTATEID);
5908
	nfsm_stateidtom(nd, &st, NFSSTATEID_PUTSTATEID);
5909
	NFSZERO_ATTRBIT(&attrbits);
5909
	NFSZERO_ATTRBIT(&attrbits);
5910
	NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_ACL);
5910
	NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_ACL);
Lines 6039-6045 nfsrv_getattrdsrpc(fhandle_t *fhp, struct ucred *cred, Link Here
6039
	NFSD_DEBUG(4, "in nfsrv_getattrdsrpc\n");
6039
	NFSD_DEBUG(4, "in nfsrv_getattrdsrpc\n");
6040
	nd = malloc(sizeof(*nd), M_TEMP, M_WAITOK | M_ZERO);
6040
	nd = malloc(sizeof(*nd), M_TEMP, M_WAITOK | M_ZERO);
6041
	nfscl_reqstart(nd, NFSPROC_GETATTR, nmp, (u_int8_t *)fhp,
6041
	nfscl_reqstart(nd, NFSPROC_GETATTR, nmp, (u_int8_t *)fhp,
6042
	    sizeof(fhandle_t), NULL, NULL, 0, 0);
6042
	    sizeof(fhandle_t), NULL, NULL, 0, 0, cred);
6043
	NFSZERO_ATTRBIT(&attrbits);
6043
	NFSZERO_ATTRBIT(&attrbits);
6044
	NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_SIZE);
6044
	NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_SIZE);
6045
	NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_CHANGE);
6045
	NFSSETBIT_ATTRBIT(&attrbits, NFSATTRBIT_CHANGE);
Lines 6107-6113 nfsrv_seekdsrpc(fhandle_t *fhp, off_t *offp, int conte Link Here
6107
	st.seqid = 0xffffffff;
6107
	st.seqid = 0xffffffff;
6108
	nd = malloc(sizeof(*nd), M_TEMP, M_WAITOK | M_ZERO);
6108
	nd = malloc(sizeof(*nd), M_TEMP, M_WAITOK | M_ZERO);
6109
	nfscl_reqstart(nd, NFSPROC_SEEKDS, nmp, (u_int8_t *)fhp,
6109
	nfscl_reqstart(nd, NFSPROC_SEEKDS, nmp, (u_int8_t *)fhp,
6110
	    sizeof(fhandle_t), NULL, NULL, 0, 0);
6110
	    sizeof(fhandle_t), NULL, NULL, 0, 0, cred);
6111
	nfsm_stateidtom(nd, &st, NFSSTATEID_PUTSTATEID);
6111
	nfsm_stateidtom(nd, &st, NFSSTATEID_PUTSTATEID);
6112
	NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + NFSX_UNSIGNED);
6112
	NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + NFSX_UNSIGNED);
6113
	txdr_hyper(*offp, tl); tl += 2;
6113
	txdr_hyper(*offp, tl); tl += 2;

Return to bug 260011