aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/cluster/tcp.c
diff options
context:
space:
mode:
authorSunil Mushran <sunil.mushran@oracle.com>2008-04-14 13:46:19 -0400
committerMark Fasheh <mfasheh@suse.com>2008-04-18 11:56:20 -0400
commit2309e9e040fe29469fb85a384636c455b62fe525 (patch)
treee3ecf7af432e1504a0c785525bc4247305916173 /fs/ocfs2/cluster/tcp.c
parent93b06edb5127315473d87e075b2b1d1acf74659c (diff)
ocfs2/net: Add debug interface to o2net
This patch exposes o2net information via debugfs. The information includes the list of sockets (sock_containers) as well as the list of outstanding messages (send_tracking). Useful for o2dlm debugging. (This patch is derived from an earlier one written by Zach Brown that exposed the same information via /proc.) [Mark: checkpatch fixes] Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com> Reviewed-by: Joel Becker <joel.becker@oracle.com> Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs/ocfs2/cluster/tcp.c')
-rw-r--r--fs/ocfs2/cluster/tcp.c68
1 files changed, 68 insertions, 0 deletions
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index 1170918a9311..1e44ad14881a 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -142,6 +142,54 @@ static void o2net_idle_timer(unsigned long data);
142static void o2net_sc_postpone_idle(struct o2net_sock_container *sc); 142static void o2net_sc_postpone_idle(struct o2net_sock_container *sc);
143static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc); 143static void o2net_sc_reset_idle_timer(struct o2net_sock_container *sc);
144 144
145static void o2net_init_nst(struct o2net_send_tracking *nst, u32 msgtype,
146 u32 msgkey, struct task_struct *task, u8 node)
147{
148#ifdef CONFIG_DEBUG_FS
149 INIT_LIST_HEAD(&nst->st_net_debug_item);
150 nst->st_task = task;
151 nst->st_msg_type = msgtype;
152 nst->st_msg_key = msgkey;
153 nst->st_node = node;
154#endif
155}
156
157static void o2net_set_nst_sock_time(struct o2net_send_tracking *nst)
158{
159#ifdef CONFIG_DEBUG_FS
160 do_gettimeofday(&nst->st_sock_time);
161#endif
162}
163
164static void o2net_set_nst_send_time(struct o2net_send_tracking *nst)
165{
166#ifdef CONFIG_DEBUG_FS
167 do_gettimeofday(&nst->st_send_time);
168#endif
169}
170
171static void o2net_set_nst_status_time(struct o2net_send_tracking *nst)
172{
173#ifdef CONFIG_DEBUG_FS
174 do_gettimeofday(&nst->st_status_time);
175#endif
176}
177
178static void o2net_set_nst_sock_container(struct o2net_send_tracking *nst,
179 struct o2net_sock_container *sc)
180{
181#ifdef CONFIG_DEBUG_FS
182 nst->st_sc = sc;
183#endif
184}
185
186static void o2net_set_nst_msg_id(struct o2net_send_tracking *nst, u32 msg_id)
187{
188#ifdef CONFIG_DEBUG_FS
189 nst->st_id = msg_id;
190#endif
191}
192
145static inline int o2net_reconnect_delay(void) 193static inline int o2net_reconnect_delay(void)
146{ 194{
147 return o2nm_single_cluster->cl_reconnect_delay_ms; 195 return o2nm_single_cluster->cl_reconnect_delay_ms;
@@ -290,6 +338,7 @@ static void sc_kref_release(struct kref *kref)
290 o2nm_node_put(sc->sc_node); 338 o2nm_node_put(sc->sc_node);
291 sc->sc_node = NULL; 339 sc->sc_node = NULL;
292 340
341 o2net_debug_del_sc(sc);
293 kfree(sc); 342 kfree(sc);
294} 343}
295 344
@@ -330,6 +379,7 @@ static struct o2net_sock_container *sc_alloc(struct o2nm_node *node)
330 379
331 ret = sc; 380 ret = sc;
332 sc->sc_page = page; 381 sc->sc_page = page;
382 o2net_debug_add_sc(sc);
333 sc = NULL; 383 sc = NULL;
334 page = NULL; 384 page = NULL;
335 385
@@ -913,6 +963,9 @@ int o2net_send_message_vec(u32 msg_type, u32 key, struct kvec *caller_vec,
913 struct o2net_status_wait nsw = { 963 struct o2net_status_wait nsw = {
914 .ns_node_item = LIST_HEAD_INIT(nsw.ns_node_item), 964 .ns_node_item = LIST_HEAD_INIT(nsw.ns_node_item),
915 }; 965 };
966 struct o2net_send_tracking nst;
967
968 o2net_init_nst(&nst, msg_type, key, current, target_node);
916 969
917 if (o2net_wq == NULL) { 970 if (o2net_wq == NULL) {
918 mlog(0, "attempt to tx without o2netd running\n"); 971 mlog(0, "attempt to tx without o2netd running\n");
@@ -938,6 +991,10 @@ int o2net_send_message_vec(u32 msg_type, u32 key, struct kvec *caller_vec,
938 goto out; 991 goto out;
939 } 992 }
940 993
994 o2net_debug_add_nst(&nst);
995
996 o2net_set_nst_sock_time(&nst);
997
941 ret = wait_event_interruptible(nn->nn_sc_wq, 998 ret = wait_event_interruptible(nn->nn_sc_wq,
942 o2net_tx_can_proceed(nn, &sc, &error)); 999 o2net_tx_can_proceed(nn, &sc, &error));
943 if (!ret && error) 1000 if (!ret && error)
@@ -945,6 +1002,8 @@ int o2net_send_message_vec(u32 msg_type, u32 key, struct kvec *caller_vec,
945 if (ret) 1002 if (ret)
946 goto out; 1003 goto out;
947 1004
1005 o2net_set_nst_sock_container(&nst, sc);
1006
948 veclen = caller_veclen + 1; 1007 veclen = caller_veclen + 1;
949 vec = kmalloc(sizeof(struct kvec) * veclen, GFP_ATOMIC); 1008 vec = kmalloc(sizeof(struct kvec) * veclen, GFP_ATOMIC);
950 if (vec == NULL) { 1009 if (vec == NULL) {
@@ -971,6 +1030,9 @@ int o2net_send_message_vec(u32 msg_type, u32 key, struct kvec *caller_vec,
971 goto out; 1030 goto out;
972 1031
973 msg->msg_num = cpu_to_be32(nsw.ns_id); 1032 msg->msg_num = cpu_to_be32(nsw.ns_id);
1033 o2net_set_nst_msg_id(&nst, nsw.ns_id);
1034
1035 o2net_set_nst_send_time(&nst);
974 1036
975 /* finally, convert the message header to network byte-order 1037 /* finally, convert the message header to network byte-order
976 * and send */ 1038 * and send */
@@ -985,6 +1047,7 @@ int o2net_send_message_vec(u32 msg_type, u32 key, struct kvec *caller_vec,
985 } 1047 }
986 1048
987 /* wait on other node's handler */ 1049 /* wait on other node's handler */
1050 o2net_set_nst_status_time(&nst);
988 wait_event(nsw.ns_wq, o2net_nsw_completed(nn, &nsw)); 1051 wait_event(nsw.ns_wq, o2net_nsw_completed(nn, &nsw));
989 1052
990 /* Note that we avoid overwriting the callers status return 1053 /* Note that we avoid overwriting the callers status return
@@ -997,6 +1060,7 @@ int o2net_send_message_vec(u32 msg_type, u32 key, struct kvec *caller_vec,
997 mlog(0, "woken, returning system status %d, user status %d\n", 1060 mlog(0, "woken, returning system status %d, user status %d\n",
998 ret, nsw.ns_status); 1061 ret, nsw.ns_status);
999out: 1062out:
1063 o2net_debug_del_nst(&nst); /* must be before dropping sc and node */
1000 if (sc) 1064 if (sc)
1001 sc_put(sc); 1065 sc_put(sc);
1002 if (vec) 1066 if (vec)
@@ -1935,6 +1999,9 @@ int o2net_init(void)
1935 1999
1936 o2quo_init(); 2000 o2quo_init();
1937 2001
2002 if (o2net_debugfs_init())
2003 return -ENOMEM;
2004
1938 o2net_hand = kzalloc(sizeof(struct o2net_handshake), GFP_KERNEL); 2005 o2net_hand = kzalloc(sizeof(struct o2net_handshake), GFP_KERNEL);
1939 o2net_keep_req = kzalloc(sizeof(struct o2net_msg), GFP_KERNEL); 2006 o2net_keep_req = kzalloc(sizeof(struct o2net_msg), GFP_KERNEL);
1940 o2net_keep_resp = kzalloc(sizeof(struct o2net_msg), GFP_KERNEL); 2007 o2net_keep_resp = kzalloc(sizeof(struct o2net_msg), GFP_KERNEL);
@@ -1976,4 +2043,5 @@ void o2net_exit(void)
1976 kfree(o2net_hand); 2043 kfree(o2net_hand);
1977 kfree(o2net_keep_req); 2044 kfree(o2net_keep_req);
1978 kfree(o2net_keep_resp); 2045 kfree(o2net_keep_resp);
2046 o2net_debugfs_exit();
1979} 2047}