fix a problem with XID re-use when a server returns NFSERR_JUKEBOX.

Submitted by:	cel@citi.umich.edu
Fixed by:	rick@snowhite.cis.uoguelph.ca
Approved by:	alfred
MFC after:	3 weeks
This commit is contained in:
Jim Rees 2005-11-21 18:39:18 +00:00
parent 16e0d8caf8
commit cb156cc603
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=152652
3 changed files with 13 additions and 7 deletions

View File

@ -77,6 +77,8 @@ __FBSDID("$FreeBSD$");
#define TRUE 1
#define FALSE 0
extern u_int32_t nfs_xid;
/*
* Estimate rto for an nfs rpc sent via. an unreliable datagram.
* Use the mean and mean deviation of rtt for the appropriate type of rpc
@ -924,7 +926,7 @@ nfs_request(struct vnode *vp, struct mbuf *mrest, int procnum,
int s, error = 0, mrest_len, auth_len, auth_type;
int trylater_delay = NQ_TRYLATERDEL, trylater_cnt = 0;
struct timeval now;
u_int32_t xid;
u_int32_t *xidp;
/* Reject requests while attempting a forced unmount. */
if (vp->v_mount->mnt_kern_flag & MNTK_UNMOUNTF) {
@ -956,7 +958,7 @@ nfs_request(struct vnode *vp, struct mbuf *mrest, int procnum,
nmp->nm_numgrps : (cred->cr_ngroups - 1)) << 2) +
5 * NFSX_UNSIGNED;
m = nfsm_rpchead(cred, nmp->nm_flag, procnum, auth_type, auth_len,
mrest, mrest_len, &mheadend, &xid);
mrest, mrest_len, &mheadend, &xidp);
/*
* For stream protocols, insert a Sun RPC Record Mark.
@ -967,7 +969,7 @@ nfs_request(struct vnode *vp, struct mbuf *mrest, int procnum,
(m->m_pkthdr.len - NFSX_UNSIGNED));
}
rep->r_mreq = m;
rep->r_xid = xid;
rep->r_xid = *xidp;
tryagain:
if (nmp->nm_flag & NFSMNT_SOFT)
rep->r_retry = nmp->nm_retry;
@ -1128,6 +1130,9 @@ nfs_request(struct vnode *vp, struct mbuf *mrest, int procnum,
trylater_delay *= nfs_backoff[trylater_cnt];
if (trylater_cnt < NFS_NBACKOFF - 1)
trylater_cnt++;
if (++nfs_xid == 0)
nfs_xid++;
rep->r_xid = *xidp = txdr_unsigned(nfs_xid);
goto tryagain;
}

View File

@ -85,7 +85,7 @@ u_int32_t rpc_call, rpc_vers, rpc_reply, rpc_msgdenied, rpc_autherr,
u_int32_t nfs_true, nfs_false;
/* And other global data */
static u_int32_t nfs_xid = 0;
u_int32_t nfs_xid = 0;
static enum vtype nv2tov_type[8]= {
VNON, VREG, VDIR, VBLK, VCHR, VLNK, VNON, VNON
};
@ -155,7 +155,7 @@ nfsm_reqhead(struct vnode *vp, u_long procid, int hsiz)
struct mbuf *
nfsm_rpchead(struct ucred *cr, int nmflag, int procid, int auth_type,
int auth_len, struct mbuf *mrest, int mrest_len, struct mbuf **mbp,
u_int32_t *xidp)
u_int32_t **xidpp)
{
struct mbuf *mb;
u_int32_t *tl;
@ -191,7 +191,8 @@ nfsm_rpchead(struct ucred *cr, int nmflag, int procid, int auth_type,
if (++nfs_xid == 0)
nfs_xid++;
*tl++ = *xidp = txdr_unsigned(nfs_xid);
*xidpp = tl;
*tl++ = txdr_unsigned(nfs_xid);
*tl++ = rpc_call;
*tl++ = rpc_vers;
*tl++ = txdr_unsigned(NFS_PROG);

View File

@ -56,7 +56,7 @@ struct mbuf *nfsm_reqhead(struct vnode *vp, u_long procid, int hsiz);
struct mbuf *nfsm_rpchead(struct ucred *cr, int nmflag, int procid,
int auth_type, int auth_len,
struct mbuf *mrest, int mrest_len,
struct mbuf **mbp, u_int32_t *xidp);
struct mbuf **mbp, u_int32_t **xidpp);
#define M_HASCL(m) ((m)->m_flags & M_EXT)
#define NFSMINOFF(m) \