]> git.karo-electronics.de Git - linux-beck.git/commitdiff
SUNRPC: Allow svc_reserve() to notify TCP socket that space has been freed
authorTrond Myklebust <trond.myklebust@primarydata.com>
Fri, 25 Jul 2014 03:59:33 +0000 (23:59 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Tue, 29 Jul 2014 20:10:20 +0000 (16:10 -0400)
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
include/linux/sunrpc/svc_xprt.h
net/sunrpc/svc_xprt.c
net/sunrpc/svcsock.c

index 5d9d6f84b38243adf1305ae2230f89515e38ed02..ce6e4182a5b2b82723d1a0c2293951b1147fd8f7 100644 (file)
@@ -25,6 +25,7 @@ struct svc_xprt_ops {
        void            (*xpo_detach)(struct svc_xprt *);
        void            (*xpo_free)(struct svc_xprt *);
        int             (*xpo_secure_port)(struct svc_rqst *);
+       void            (*xpo_adjust_wspace)(struct svc_xprt *);
 };
 
 struct svc_xprt_class {
index 9cfa391e2bd06c3791e72286b361583b8faffe9b..6666c67458581dd03a03dff1557fcba4a6c5e098 100644 (file)
@@ -448,6 +448,8 @@ void svc_reserve(struct svc_rqst *rqstp, int space)
                atomic_sub((rqstp->rq_reserved - space), &xprt->xpt_reserved);
                rqstp->rq_reserved = space;
 
+               if (xprt->xpt_ops->xpo_adjust_wspace)
+                       xprt->xpt_ops->xpo_adjust_wspace(xprt);
                svc_xprt_enqueue(xprt);
        }
 }
index 88db211d4264788249b08c991a7eed835e5aafc6..c24a8ff33f8fa1f5a66da0b4f2a57f775c86cb51 100644 (file)
@@ -475,6 +475,14 @@ static void svc_tcp_write_space(struct sock *sk)
        svc_write_space(sk);
 }
 
+static void svc_tcp_adjust_wspace(struct svc_xprt *xprt)
+{
+       struct svc_sock *svsk = container_of(xprt, struct svc_sock, sk_xprt);
+
+       if (svc_tcp_has_wspace(xprt))
+               clear_bit(SOCK_NOSPACE, &svsk->sk_sock->flags);
+}
+
 /*
  * See net/ipv6/ip_sockglue.c : ip_cmsg_recv_pktinfo
  */
@@ -1289,6 +1297,7 @@ static struct svc_xprt_ops svc_tcp_ops = {
        .xpo_has_wspace = svc_tcp_has_wspace,
        .xpo_accept = svc_tcp_accept,
        .xpo_secure_port = svc_sock_secure_port,
+       .xpo_adjust_wspace = svc_tcp_adjust_wspace,
 };
 
 static struct svc_xprt_class svc_tcp_class = {