mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Trond Myklebust <Trond.Myklebust@netapp.com>
To: Ian Campbell <ijc@hellion.org.uk>
Cc: linux-nfs@vger.kernel.org, Max Kellermann <mk@cm4all.com>,
	linux-kernel@vger.kernel.org, gcosta@redhat.com,
	Grant Coady <grant_lkml@dodo.com.au>,
	"J. Bruce Fields" <bfields@fieldses.org>,
	Tom Tucker <tom@opengridcomputing.com>
Subject: Re: [PATCH 1/3] SUNRPC: Ensure the server closes sockets in a timely fashion
Date: Sun, 30 Nov 2008 19:18:39 -0500	[thread overview]
Message-ID: <1228090719.7112.13.camel@heimdal.trondhjem.org> (raw)
In-Reply-To: <1228090631.7112.11.camel@heimdal.trondhjem.org>

We want to ensure that connected sockets close down the connection when we
set XPT_CLOSE, so that we don't keep it hanging while cleaning up all the
stuff that is keeping a reference to the socket.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
---

 net/sunrpc/svcsock.c |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)


diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 95293f5..a1b048d 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -59,6 +59,7 @@ static void		svc_udp_data_ready(struct sock *, int);
 static int		svc_udp_recvfrom(struct svc_rqst *);
 static int		svc_udp_sendto(struct svc_rqst *);
 static void		svc_sock_detach(struct svc_xprt *);
+static void		svc_tcp_sock_detach(struct svc_xprt *);
 static void		svc_sock_free(struct svc_xprt *);
 
 static struct svc_xprt *svc_create_socket(struct svc_serv *, int,
@@ -1017,7 +1018,7 @@ static struct svc_xprt_ops svc_tcp_ops = {
 	.xpo_recvfrom = svc_tcp_recvfrom,
 	.xpo_sendto = svc_tcp_sendto,
 	.xpo_release_rqst = svc_release_skb,
-	.xpo_detach = svc_sock_detach,
+	.xpo_detach = svc_tcp_sock_detach,
 	.xpo_free = svc_sock_free,
 	.xpo_prep_reply_hdr = svc_tcp_prep_reply_hdr,
 	.xpo_has_wspace = svc_tcp_has_wspace,
@@ -1282,6 +1283,24 @@ static void svc_sock_detach(struct svc_xprt *xprt)
 	sk->sk_state_change = svsk->sk_ostate;
 	sk->sk_data_ready = svsk->sk_odata;
 	sk->sk_write_space = svsk->sk_owspace;
+
+	if (sk->sk_sleep && waitqueue_active(sk->sk_sleep))
+		wake_up_interruptible(sk->sk_sleep);
+}
+
+/*
+ * Disconnect the socket, and reset the callbacks
+ */
+static void svc_tcp_sock_detach(struct svc_xprt *xprt)
+{
+	struct svc_sock *svsk = container_of(xprt, struct svc_sock, sk_xprt);
+
+	dprintk("svc: svc_tcp_sock_detach(%p)\n", svsk);
+
+	svc_sock_detach(xprt);
+
+	if (!test_bit(XPT_LISTENER, &xprt->xpt_flags))
+		kernel_sock_shutdown(svsk->sk_sock, SHUT_RDWR);
 }
 
 /*

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@netapp.com
www.netapp.com

  reply	other threads:[~2008-12-01  0:18 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-17 12:32 [PATCH] NFS regression in 2.6.26?, "task blocked for more than 120 seconds" Max Kellermann
2008-10-17 14:33 ` Glauber Costa
2008-10-20  6:51   ` Max Kellermann
2008-10-20  7:43     ` Ian Campbell
2008-10-20 13:15     ` Glauber Costa
2008-10-20 14:12       ` Max Kellermann
2008-10-20 14:34         ` Cyrill Gorcunov
2008-10-20 14:21       ` Cyrill Gorcunov
2009-05-22 20:59     ` H. Peter Anvin
2009-05-25 13:12       ` Max Kellermann
2008-10-20  6:27 ` Ian Campbell
2008-11-01 11:45   ` Ian Campbell
2008-11-01 13:41     ` Trond Myklebust
2008-11-02 14:40       ` Ian Campbell
2008-11-07  2:12         ` kenneth johansson
2008-11-04 19:10       ` Ian Campbell
2008-11-25  7:09       ` Ian Campbell
2008-11-25 13:28         ` Trond Myklebust
2008-11-25 13:38           ` Ian Campbell
2008-11-25 13:57             ` Trond Myklebust
2008-11-25 14:04               ` Ian Campbell
2008-11-26 22:12                 ` Ian Campbell
2008-12-01  0:17                   ` [PATCH 0/3] " Trond Myklebust
2008-12-01  0:18                     ` Trond Myklebust [this message]
2008-12-17 15:27                       ` [PATCH 1/3] SUNRPC: Ensure the server closes sockets in a timely fashion Tom Tucker
2008-12-17 18:08                         ` Trond Myklebust
2008-12-17 18:59                           ` Tom Tucker
2008-12-01  0:19                     ` [PATCH 2/3] SUNRPC: We only need to call svc_delete_xprt() once Trond Myklebust
2008-12-01  0:20                     ` [PATCH 3/3] SUNRPC: svc_xprt_enqueue should not refuse to enqueue 'XPT_DEAD' transports Trond Myklebust
2008-12-17 15:35                       ` Tom Tucker
2008-12-17 19:07                         ` Trond Myklebust
2008-12-23 14:49                           ` Tom Tucker
2008-12-23 23:39                             ` Tom Tucker
2008-12-01  0:29                     ` [PATCH 0/3] NFS regression in 2.6.26?, "task blocked for more than 120 seconds" Trond Myklebust
2008-12-02 15:22                       ` Kasparek Tomas
2008-12-02 15:37                         ` Trond Myklebust
2008-12-02 16:26                           ` Kasparek Tomas
2008-12-02 18:10                             ` Trond Myklebust
2008-12-01 22:09                     ` Ian Campbell
2008-12-06 12:16                       ` Ian Campbell
2008-12-14 18:24                         ` Ian Campbell
2008-12-16 17:55                           ` J. Bruce Fields
2008-12-16 18:39                             ` Ian Campbell
2009-01-07 22:21                               ` J. Bruce Fields
2009-01-08 18:20                                 ` J. Bruce Fields
2009-01-08 21:22                                   ` Ian Campbell
2009-01-08 21:26                                     ` J. Bruce Fields
2009-01-12  9:46                                       ` Ian Campbell
2009-01-22  8:27                                       ` Ian Campbell
2009-01-22 16:44                                         ` J. Bruce Fields

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1228090719.7112.13.camel@heimdal.trondhjem.org \
    --to=trond.myklebust@netapp.com \
    --cc=bfields@fieldses.org \
    --cc=gcosta@redhat.com \
    --cc=grant_lkml@dodo.com.au \
    --cc=ijc@hellion.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=mk@cm4all.com \
    --cc=tom@opengridcomputing.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®