if ((error = soreserve(so, sndreserve, rcvreserve)) != 0)
error = soreserve(so, sndreserve, rcvreserve); if (error)
nfs_connect(nmp, rep)	register struct nfsmount *nmp;	struct nfsreq *rep;{	register struct socket *so;	int s, error, rcvreserve, sndreserve;	struct sockaddr *saddr;	struct sockaddr_in *sin;	struct mbuf *m;	u_int16_t tport;	nmp->nm_so = (struct socket *)0;	saddr = mtod(nmp->nm_nam, struct sockaddr *);	error = socreate(saddr->sa_family,			 &nmp->nm_so, nmp->nm_sotype, nmp->nm_soproto);	if (error)		goto bad;	so = nmp->nm_so;	nmp->nm_soflags = so->so_proto->pr_flags;	/*	 * Some servers require that the client port be a reserved port number.	 */	if (saddr->sa_family == AF_INET && (nmp->nm_flag & NFSMNT_RESVPORT)) {		MGET(m, M_WAIT, MT_SONAME);		sin = mtod(m, struct sockaddr_in *);		sin->sin_len = m->m_len = sizeof (struct sockaddr_in);		sin->sin_family = AF_INET;		sin->sin_addr.s_addr = INADDR_ANY;		tport = IPPORT_RESERVED - 1;		sin->sin_port = htons(tport);		while ((error = sobind(so, m)) == EADDRINUSE &&		       --tport > IPPORT_RESERVED / 2)			sin->sin_port = htons(tport);		m_freem(m);		if (error)			goto bad;	}	/*	 * Protocols that do not require connections may be optionally left	 * unconnected for servers that reply from a port other than NFS_PORT.	 */	if (nmp->nm_flag & NFSMNT_NOCONN) {		if (nmp->nm_soflags & PR_CONNREQUIRED) {			error = ENOTCONN;			goto bad;		}	} else {		if ((error = soconnect(so, nmp->nm_nam)) != 0)			goto bad;		/*		 * Wait for the connection to complete. Cribbed from the		 * connect system call but with the wait timing out so		 * that interruptible mounts don't hang here for a long time.		 */		s = splsoftnet();		while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) {			(void) tsleep((caddr_t)&so->so_timeo, PSOCK,				"nfscon", 2 * hz);			if ((so->so_state & SS_ISCONNECTING) &&			    so->so_error == 0 && rep &&			    (error = nfs_sigintr(nmp, rep, rep->r_procp))) {				so->so_state &= ~SS_ISCONNECTING;				splx(s);				goto bad;			}		}		if (so->so_error) {			error = so->so_error;			so->so_error = 0;			splx(s);			goto bad;		}		splx(s);	}	if (nmp->nm_flag & (NFSMNT_SOFT | NFSMNT_INT)) {		so->so_rcv.sb_timeo = (5 * hz);		so->so_snd.sb_timeo = (5 * hz);	} else {		so->so_rcv.sb_timeo = 0;		so->so_snd.sb_timeo = 0;	}	if (nmp->nm_sotype == SOCK_DGRAM) {		sndreserve = nmp->nm_wsize + NFS_MAXPKTHDR;		rcvreserve = nmp->nm_rsize + NFS_MAXPKTHDR;	} else if (nmp->nm_sotype == SOCK_SEQPACKET) {		sndreserve = (nmp->nm_wsize + NFS_MAXPKTHDR) * 2;		rcvreserve = (nmp->nm_rsize + NFS_MAXPKTHDR) * 2;	} else {		if (nmp->nm_sotype != SOCK_STREAM)			panic("nfscon sotype");		if (so->so_proto->pr_flags & PR_CONNREQUIRED) {			MGET(m, M_WAIT, MT_SOOPTS);			*mtod(m, int32_t *) = 1;			m->m_len = sizeof(int32_t);			sosetopt(so, SOL_SOCKET, SO_KEEPALIVE, m);		}		if (so->so_proto->pr_protocol == IPPROTO_TCP) {			MGET(m, M_WAIT, MT_SOOPTS);			*mtod(m, int32_t *) = 1;			m->m_len = sizeof(int32_t);			sosetopt(so, IPPROTO_TCP, TCP_NODELAY, m);		}		sndreserve = (nmp->nm_wsize + NFS_MAXPKTHDR +		    sizeof (u_int32_t)) * 2;		rcvreserve = (nmp->nm_rsize + NFS_MAXPKTHDR +		    sizeof (u_int32_t)) * 2;	}	if ((error = soreserve(so, sndreserve, rcvreserve)) != 0)		goto bad;	so->so_rcv.sb_flags |= SB_NOINTR;	so->so_snd.sb_flags |= SB_NOINTR;	/* Initialize other non-zero congestion variables */	nmp->nm_srtt[0] = nmp->nm_srtt[1] = nmp->nm_srtt[2] = nmp->nm_srtt[3] =		nmp->nm_srtt[4] = (NFS_TIMEO << 3);	nmp->nm_sdrtt[0] = nmp->nm_sdrtt[1] = nmp->nm_sdrtt[2] =		nmp->nm_sdrtt[3] = nmp->nm_sdrtt[4] = 0;	nmp->nm_cwnd = NFS_MAXCWND / 2;	    /* Initial send window */	nmp->nm_sent = 0;	nmp->nm_timeouts = 0;	return (0);bad:	nfs_disconnect(nmp);	return (error);}