Commit 9f632054 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] kNFSd: RPC server need to know that TCP and UDP have different wspace functions.

From: Hirokazu Takahashi <taka@valinux.co.jp>

sock_wspace() is used to see how much can be written to a udp socket,
but tcp_wspace must be used on a tcp socket.
This patch informs sunrpc/svcsock.c of this subtlety.
parent be4ad944
......@@ -35,6 +35,7 @@
#include <net/sock.h>
#include <net/checksum.h>
#include <net/ip.h>
#include <net/tcp.h>
#include <asm/uaccess.h>
#include <asm/ioctls.h>
......@@ -115,6 +116,22 @@ svc_release_skb(struct svc_rqst *rqstp)
}
}
/*
* Any space to write?
*/
static inline unsigned long
svc_sock_wspace(struct svc_sock *svsk)
{
int wspace;
if (svsk->sk_sock->type == SOCK_STREAM)
wspace = tcp_wspace(svsk->sk_sk);
else
wspace = sock_wspace(svsk->sk_sk);
return wspace;
}
/*
* Queue up a socket with data pending. If there are idle nfsd
* processes, wake 'em up.
......@@ -150,13 +167,13 @@ svc_sock_enqueue(struct svc_sock *svsk)
}
if (((svsk->sk_reserved + serv->sv_bufsz)*2
> sock_wspace(svsk->sk_sk))
> svc_sock_wspace(svsk))
&& !test_bit(SK_CLOSE, &svsk->sk_flags)
&& !test_bit(SK_CONN, &svsk->sk_flags)) {
/* Don't enqueue while not enough space for reply */
dprintk("svc: socket %p no space, %d*2 > %ld, not enqueued\n",
svsk->sk_sk, svsk->sk_reserved+serv->sv_bufsz,
sock_wspace(svsk->sk_sk));
svc_sock_wspace(svsk));
goto out_unlock;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment