MFC: nfs_socket.c 1.132, nfs_subs.c 1.142, nfsm_subs.h 1.37

fix a problem with XID re-use when a server returns NFSERR_JUKEBOX.
This commit is contained in:
rees 2005-12-13 21:29:26 +00:00
parent 786e4e87b4
commit 94b8aef59a
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;
@ -1113,6 +1115,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) \