[Ocfs2-commits] mfasheh commits r1996 - branches/usysfsify/fs/ocfs2/cluster

svn-commits at oss.oracle.com svn-commits at oss.oracle.com
Thu Mar 17 15:41:39 CST 2005


Author: mfasheh
Date: 2005-03-17 15:41:37 -0600 (Thu, 17 Mar 2005)
New Revision: 1996

Modified:
   branches/usysfsify/fs/ocfs2/cluster/tcp.c
Log:
* Merged 1981:1983 from trunk:
	- [1981] fix up the error code return code in net_process_message
	- [1983] only destroy the socket in net_send_message on network errors



Modified: branches/usysfsify/fs/ocfs2/cluster/tcp.c
===================================================================
--- branches/usysfsify/fs/ocfs2/cluster/tcp.c	2005-03-17 20:14:59 UTC (rev 1995)
+++ branches/usysfsify/fs/ocfs2/cluster/tcp.c	2005-03-17 21:41:37 UTC (rev 1996)
@@ -468,6 +468,7 @@
 {
 	int ret;
 	int cleanup_wq = 0;
+	int cleanup_sock = 1;
 	net_msg *msg = NULL;
 	net_status_ctxt nsc;
 	wait_queue_t sleep;
@@ -568,11 +569,14 @@
 	netprintk("woken, returning system status %d, user status %d",
 		  ret, nsc.status);
 
+	/* At this point only destroy the socket if the other node died. */
+	if (ret != -EHOSTDOWN)
+		cleanup_sock = 0;
 out:
 	if (cleanup_wq)
 		remove_wait_queue(&nsc.wq, &sleep);
 	if (sock)
-		net_sock_decref(sock, ret);
+		net_sock_decref(sock, cleanup_sock);
 	if (iov)
 		kfree(iov);
 	if (msg)
@@ -946,7 +950,7 @@
  * after this is called the buffer us reused for the next message */
 static int net_process_message(struct socket *sock, net_msg *hdr)
 {
-	int ret, tmpret;
+	int ret, handler_status;
 	enum net_system_error syserr;
 	net_msg_handler *hnd = NULL;
 
@@ -977,6 +981,7 @@
 
 	/* find a handler for it */
 	ret = 0;
+	handler_status = 0;
 	hnd = net_lookup_handler(hdr->msg_type, hdr->key);
 	if (!hnd) {
 		syserr = NET_ERR_NO_HNDLR;
@@ -993,14 +998,14 @@
 	if (syserr != NET_ERR_NONE)
 		goto out_respond;
 
-	ret = (hnd->func)(hdr, sizeof(net_msg) + hdr->data_len, hnd->data);
+	handler_status = (hnd->func)(hdr, sizeof(net_msg) + hdr->data_len, hnd->data);
 
 out_respond:
 	/* this destroys the hdr, so don't use it after this */
-	tmpret = net_send_status_magic(sock, hdr, syserr, ret);
+	ret = net_send_status_magic(sock, hdr, syserr, handler_status);
 	hdr = NULL;
-	netprintk("sending status %d, syserr %d returned %d\n", ret, syserr,
-		  tmpret);
+	netprintk("sending handler status %d, syserr %d returned %d\n",
+		  handler_status, syserr, ret);
 
 out:
 	if (hnd)



More information about the Ocfs2-commits mailing list