Fix for a bug where NFS/TCP would not reconnect (in the case where

the server FIN'ed). Seen with Solaris NFS servers.

Reported by:	TOMITA Yoshinori <yoshint@flab.fujitsu.co.jp>
Submitted by:	Mohan Strinivasan
This commit is contained in:
Paul Saab 2005-11-21 19:25:24 +00:00
parent 3834aac17e
commit 38b29f71ef
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=152657

View File

@ -523,6 +523,17 @@ nfs_send(struct socket *so, struct sockaddr *nam, struct mbuf *top,
return (error);
}
static __inline int
nfs_cantrecvmore(struct socket *so)
{
int ret;
SOCKBUF_LOCK(&so->so_rcv);
ret = (so->so_rcv.sb_state & SBS_CANTRCVMORE);
SOCKBUF_UNLOCK(&so->so_rcv);
return ret;
}
int
nfs_reply(struct nfsreq *rep)
{
@ -552,7 +563,7 @@ nfs_reply(struct nfsreq *rep)
}
so = rep->r_nmp->nm_so;
mtx_lock(&rep->r_nmp->nm_nfstcpstate.mtx);
if (!so ||
if (!so || nfs_cantrecvmore(so) ||
(rep->r_nmp->nm_nfstcpstate.flags & NFS_TCP_FORCE_RECONNECT)) {
mtx_unlock(&rep->r_nmp->nm_nfstcpstate.mtx);
error = nfs_reconnect(rep);