[Ocfs2-commits] zab commits r1766 - trunk/cluster
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Thu Jan 13 14:01:49 CST 2005
Author: zab
Date: 2005-01-13 14:01:47 -0600 (Thu, 13 Jan 2005)
New Revision: 1766
Modified:
trunk/cluster/tcp.c
Log:
o be sure to give different messages different message numbers. when
all messages have the same num a status reply is sent to the first message
waiting for status in the list instead of the intended waiter.
Modified: trunk/cluster/tcp.c
===================================================================
--- trunk/cluster/tcp.c 2005-01-13 01:41:18 UTC (rev 1765)
+++ trunk/cluster/tcp.c 2005-01-13 20:01:47 UTC (rev 1766)
@@ -40,7 +40,6 @@
* - refcounting around sock against tx/teardown/etc
* - get sin/iov/msg off the stack, per sock structures
* - share code between net_send_message{,arr}()
- * - clean up net_msg_num
* - net_send_tcp_msg() callers should pass an iov
* - just rely on rx calls to discover busted sockets?
* - make sk_state another define
@@ -859,9 +858,19 @@
return status;
} /* net_send_tcp_msg */
-static spinlock_t net_msg_num_lock = SPIN_LOCK_UNLOCKED;
-static u64 net_msg_num = 1;
+static u64 net_next_msg_num(void)
+{
+ static spinlock_t net_msg_num_lock = SPIN_LOCK_UNLOCKED;
+ static u64 net_msg_num = 1;
+ u64 ret;
+ spin_lock(&net_msg_num_lock);
+ ret = net_msg_num++;
+ spin_unlock(&net_msg_num_lock);
+
+ return ret;
+}
+
/*
* net_send_message
*
@@ -933,13 +942,8 @@
msg->data_len = len;
msg->msg_type = msg_type;
msg->key = key;
- spin_lock(&net_msg_num_lock);
- msg->msg_num = net_msg_num;
- if (net_msg_num == NET_MSG_NUM_MAX) {
- netprintk0("eek! net_msg_num wrapping to 1 now...\n");
- net_msg_num = 1;
- }
- spin_unlock(&net_msg_num_lock);
+ msg->msg_num = net_next_msg_num();
+
if (len > 0)
memcpy(&(msg->buf[0]), data, len);
@@ -1064,13 +1068,8 @@
msg->data_len = len;
msg->msg_type = msg_type;
msg->key = key;
- spin_lock(&net_msg_num_lock);
- msg->msg_num = net_msg_num;
- if (net_msg_num == NET_MSG_NUM_MAX) {
- netprintk0("eek! net_msg_num wrapping to 1 now...\n");
- net_msg_num = 1;
- }
- spin_unlock(&net_msg_num_lock);
+ msg->msg_num = net_next_msg_num();
+
if (len > 0) {
int tmplen = len;
dest = &(msg->buf[0]);
More information about the Ocfs2-commits
mailing list