* [PATCH] kNFSd - 4 of 6 - Make sure nfs/tcp socket only gets closed once.
@ 2003-09-04 6:25 NeilBrown
2003-09-04 12:53 ` Marcelo Tosatti
0 siblings, 1 reply; 3+ messages in thread
From: NeilBrown @ 2003-09-04 6:25 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: nfs
It is possible for svc_delete_socket to be called multiple times,
which can cause problems. This patch uses SK_DEAD to make sure it
only has any effect the first time, and uses SK_DEAD in a few other
places to make sure nothing is done on a deleted socket.
diff ./net/sunrpc/svcsock.c~current~ ./net/sunrpc/svcsock.c
--- ./net/sunrpc/svcsock.c~current~ 2003-09-04 11:32:12.000000000 +1000
+++ ./net/sunrpc/svcsock.c 2003-09-04 11:45:48.000000000 +1000
@@ -120,6 +120,8 @@ svc_sock_enqueue(struct svc_sock *svsk)
if (!(svsk->sk_flags &
( (1<<SK_CONN)|(1<<SK_DATA)|(1<<SK_CLOSE)) ))
return;
+ if (test_bit(SK_DEAD, &svsk->sk_flags))
+ return;
spin_lock_bh(&serv->sv_lock);
@@ -930,6 +932,9 @@ svc_tcp_sendto(struct svc_rqst *rqstp)
bufp->iov[0].iov_len = bufp->len << 2;
bufp->base[0] = htonl(0x80000000|((bufp->len << 2) - 4));
+ if (test_bit(SK_DEAD, &rqstp->rq_sock->sk_flags))
+ return -ENOTCONN;
+
sent = svc_sendto(rqstp, bufp->iov, bufp->nriov);
if (sent != bufp->len<<2) {
printk(KERN_NOTICE "rpc-srv/tcp: %s: sent only %d bytes of %d - shutting down socket\n",
@@ -1277,6 +1282,9 @@ svc_delete_socket(struct svc_sock *svsk)
dprintk("svc: svc_delete_socket(%p)\n", svsk);
+ if (test_and_set_bit(SK_DEAD, &svsk->sk_flags))
+ return ;
+
serv = svsk->sk_server;
sk = svsk->sk_sk;
@@ -1293,8 +1301,6 @@ svc_delete_socket(struct svc_sock *svsk)
list_del(&svsk->sk_ready);
- set_bit(SK_DEAD, &svsk->sk_flags);
-
if (!svsk->sk_inuse) {
spin_unlock_bh(&serv->sv_lock);
sock_release(svsk->sk_sock);
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] kNFSd - 4 of 6 - Make sure nfs/tcp socket only gets closed once.
2003-09-04 6:25 [PATCH] kNFSd - 4 of 6 - Make sure nfs/tcp socket only gets closed once NeilBrown
@ 2003-09-04 12:53 ` Marcelo Tosatti
2003-09-04 18:53 ` Marcelo Tosatti
0 siblings, 1 reply; 3+ messages in thread
From: Marcelo Tosatti @ 2003-09-04 12:53 UTC (permalink / raw)
To: NeilBrown; +Cc: Marcelo Tosatti, nfs
On Thu, 4 Sep 2003, NeilBrown wrote:
>
> It is possible for svc_delete_socket to be called multiple times,
> which can cause problems. This patch uses SK_DEAD to make sure it
> only has any effect the first time, and uses SK_DEAD in a few other
> places to make sure nothing is done on a deleted socket.
Can you please send me this patch attached instead inlined? Its not
applying correctly due to some issue in email transport.
Thanks
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] kNFSd - 4 of 6 - Make sure nfs/tcp socket only gets closed once.
2003-09-04 12:53 ` Marcelo Tosatti
@ 2003-09-04 18:53 ` Marcelo Tosatti
0 siblings, 0 replies; 3+ messages in thread
From: Marcelo Tosatti @ 2003-09-04 18:53 UTC (permalink / raw)
To: Marcelo Tosatti; +Cc: NeilBrown, nfs
On Thu, 4 Sep 2003, Marcelo Tosatti wrote:
>
>
> On Thu, 4 Sep 2003, NeilBrown wrote:
>
> >
> > It is possible for svc_delete_socket to be called multiple times,
> > which can cause problems. This patch uses SK_DEAD to make sure it
> > only has any effect the first time, and uses SK_DEAD in a few other
> > places to make sure nothing is done on a deleted socket.
>
> Can you please send me this patch attached instead inlined? Its not
> applying correctly due to some issue in email transport.
Nevermind, it was a local problem.
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-09-04 18:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-09-04 6:25 [PATCH] kNFSd - 4 of 6 - Make sure nfs/tcp socket only gets closed once NeilBrown
2003-09-04 12:53 ` Marcelo Tosatti
2003-09-04 18:53 ` Marcelo Tosatti
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.