diff -ur linux-2.4.21/include/linux/sunrpc/svcsock.h nfs/include/linux/sunrpc/svcsock.h --- linux-2.4.21/include/linux/sunrpc/svcsock.h 2003-09-15 23:02:05.000000000 +0200 +++ nfs/include/linux/sunrpc/svcsock.h 2003-10-09 16:43:30.000000000 +0200 @@ -33,6 +33,7 @@ #define SK_CHNGBUF 7 /* need to change snd/rcv buffer sizes */ int sk_reserved; /* space on outq that is reserved */ + struct semaphore sk_sendlock; int (*sk_recvfrom)(struct svc_rqst *rqstp); int (*sk_sendto)(struct svc_rqst *rqstp); diff -ur linux-2.4.21/net/sunrpc/svcsock.c nfs/net/sunrpc/svcsock.c --- linux-2.4.21/net/sunrpc/svcsock.c 2003-10-08 15:36:27.000000000 +0200 +++ nfs/net/sunrpc/svcsock.c 2003-10-09 16:46:15.000000000 +0200 @@ -935,6 +935,7 @@ static int svc_tcp_sendto(struct svc_rqst *rqstp) { + struct svc_sock *svsk = rqstp->rq_sock; struct svc_buf *bufp = &rqstp->rq_resbuf; int sent; @@ -949,7 +950,10 @@ if (test_bit(SK_DEAD, &rqstp->rq_sock->sk_flags)) return -ENOTCONN; + down(&svsk->sk_sendlock); sent = svc_sendto(rqstp, bufp->iov, bufp->nriov); + up(&svsk->sk_sendlock); + if (sent != bufp->len<<2) { printk(KERN_NOTICE "rpc-srv/tcp: %s: sent only %d bytes of %d - shutting down socket\n", rqstp->rq_sock->sk_server->sv_name, @@ -1191,6 +1195,8 @@ } memset(svsk, 0, sizeof(*svsk)); + init_MUTEX(&svsk->sk_sendlock); + inet = sock->sk; inet->user_data = svsk; svsk->sk_sock = sock;