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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs