patch-2.4.3 linux/net/sunrpc/svcsock.c

Next file: linux/net/sysctl_net.c
Previous file: linux/net/sched/sch_tbf.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.2/linux/net/sunrpc/svcsock.c linux/net/sunrpc/svcsock.c
@@ -212,16 +212,20 @@
 svc_sock_release(struct svc_rqst *rqstp)
 {
 	struct svc_sock	*svsk = rqstp->rq_sock;
+	struct svc_serv	*serv = svsk->sk_server;
 
-	if (!svsk)
-		return;
 	svc_release_skb(rqstp);
 	rqstp->rq_sock = NULL;
+
+	spin_lock_bh(&serv->sv_lock);
 	if (!--(svsk->sk_inuse) && svsk->sk_dead) {
+		spin_unlock_bh(&serv->sv_lock);
 		dprintk("svc: releasing dead socket\n");
 		sock_release(svsk->sk_sock);
 		kfree(svsk);
 	}
+	else
+		spin_unlock_bh(&serv->sv_lock);
 }
 
 /*
@@ -1034,14 +1038,15 @@
 	if (svsk->sk_qued)
 		rpc_remove_list(&serv->sv_sockets, svsk);
 
-	spin_unlock_bh(&serv->sv_lock);
 
 	svsk->sk_dead = 1;
 
 	if (!svsk->sk_inuse) {
+		spin_unlock_bh(&serv->sv_lock);
 		sock_release(svsk->sk_sock);
 		kfree(svsk);
 	} else {
+		spin_unlock_bh(&serv->sv_lock);
 		printk(KERN_NOTICE "svc: server socket destroy delayed\n");
 		/* svsk->sk_server = NULL; */
 	}

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)