ocfs2: prints peer node number when sending tcp msg failed
PATCH 1/1 ocfs2: prints peer node number when sending tcp msg failed
This patch adds prints of the number of peer node to which sending tcp message failed. It helps debugging.
--- fs/ocfs2/cluster/masklog.h | 9 +++++++++ fs/ocfs2/cluster/tcp.c | 9 +++++++-- fs/ocfs2/dlm/dlmast.c | 2 +- fs/ocfs2/dlm/dlmconvert.c | 2 +- fs/ocfs2/dlm/dlmunlock.c | 2 +- 5 files changed, 19 insertions(+), 5 deletions(-)
fs/ocfs2/cluster/masklog.h +9 -0
@@ -219,6 +219,15 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;mlog (ML_ERROR ,"status = %lld\n" , (long long )_st); \ }while (0 ) +/* "node" is number of the node to which sending tcp msg failed */ +#define mlog_network_errno (st, node) do { \ + int _st = (st); \ + if (_st != -ERESTARTSYS && _st != -EINTR && \ + _st != AOP_TRUNCATED_PAGE && _st != -ENOSPC) \ + mlog(ML_ERROR, "failed to send msg to %u. " \ + "errno: %lld\n", (u32)(node), (long long)_st); \ +} while (0) +#if defined(CONFIG_OCFS2_DEBUG_MASKLOG ) #define mlog_entry(fmt, args...) do { \ mlog(ML_ENTRY, "ENTRY:" fmt , ##args); \
fs/ocfs2/cluster/tcp.c +7 -2
@@ -1092,12 +1092,17 @@ EXPORT_SYMBOL_GPL(o2net_send_message_vec);int o2net_send_message (u32 msg_type,u32 key,void *data,u32 len,u8 target_node,int *status) { +int ret;struct kvec vec = { .iov_base = data, .iov_len = len, }; -return o2net_send_message_vec (msg_type, key, &vec,1 , - target_node, status); + + ret =o2net_send_message_vec (msg_type, key, &vec,1 , + target_node, status); +if (ret <0 ) +mlog_network_errno (ret, target_node); +return ret; }EXPORT_SYMBOL_GPL (o2net_send_message);
fs/ocfs2/dlm/dlmast.c +1 -1
@@ -453,7 +453,7 @@ int dlm_send_proxy_ast_msg(struct dlm_ctxt *dlm, struct dlm_lock_resource *res, ret =o2net_send_message_vec (DLM_PROXY_AST_MSG , dlm->key, vec, veclen, lock->ml.node, &status);if (ret <0 ) -mlog_errno (ret); +mlog_network_errno (ret, lock->ml.node);else {if (status ==DLM_RECOVERING ) { mlog(ML_ERROR, "sent AST to node %u, it thinks this "
fs/ocfs2/dlm/dlmconvert.c +1 -1
@@ -391,7 +391,7 @@ static enum dlm_status dlm_send_remote_convert_request(struct dlm_ctxt *dlm, }else if (ret !=DLM_NORMAL && ret !=DLM_NOTQUEUED )dlm_error (ret); }else { -mlog_errno (tmpret); +mlog_network_errno (tmpret, res->owner);if (dlm_is_host_down (tmpret)) {/* instead of logging the same network error over * and over, sleep here and wait for the heartbeat
fs/ocfs2/dlm/dlmunlock.c +1 -1
@@ -355,7 +355,7 @@ static enum dlm_status dlm_send_remote_unlock_request(struct dlm_ctxt *dlm,mlog (0 ,"master was in-progress. retry\n" ); ret = status; }else { -mlog_errno (tmpret); +mlog_network_errno (tmpret, owner);if (dlm_is_host_down (tmpret)) {/* NOTE: this seems strange, but it is what we want. * when the master goes down during a cancel or
Signature · 1 line
1.6.6.1
PATCH 1/1 ocfs2: prints peer node number when sending tcp msg failed
Yes knowing the node number will be very useful.
Wondering why not just have the mlog in o2net_send_message_vec(). Fewer changes. Do you see any downside?
Quoted 96 lines · Wengang Wang
This patch adds prints of the number of peer node to which sending tcp message failed. It helps debugging.
Signed-off-by Wengang Wang <[email protected]>--- fs/ocfs2/cluster/masklog.h | 9 +++++++++ fs/ocfs2/cluster/tcp.c | 9 +++++++-- fs/ocfs2/dlm/dlmast.c | 2 +- fs/ocfs2/dlm/dlmconvert.c | 2 +- fs/ocfs2/dlm/dlmunlock.c | 2 +- 5 files changed, 19 insertions(+), 5 deletions(-)fs/ocfs2/cluster/masklog.h +9
-0@@ -219,6 +219,15 @@ extern struct mlog_bits mlog_and_bits, mlog_not_bits;mlog (ML_ERROR ,"status = %lld\n" , (long long )_st); \ }while (0 ) +/* "node" is number of the node to which sending tcp msg failed */ +#define mlog_network_errno (st, node) do { \ + int _st = (st); \ + if (_st != -ERESTARTSYS && _st != -EINTR && \ + _st != AOP_TRUNCATED_PAGE && _st != -ENOSPC) \ + mlog(ML_ERROR, "failed to send msg to %u. " \ + "errno: %lld\n", (u32)(node), (long long)_st); \ +} while (0) +#if defined(CONFIG_OCFS2_DEBUG_MASKLOG ) #define mlog_entry(fmt, args...) do { \ mlog(ML_ENTRY, "ENTRY:" fmt , ##args); \fs/ocfs2/cluster/tcp.c +7
-2@@ -1092,12 +1092,17 @@ EXPORT_SYMBOL_GPL(o2net_send_message_vec);int o2net_send_message (u32 msg_type,u32 key,void *data,u32 len,u8 target_node,int *status) { +int ret;struct kvec vec = { .iov_base = data, .iov_len = len, }; -return o2net_send_message_vec (msg_type, key, &vec,1 , - target_node, status); + + ret =o2net_send_message_vec (msg_type, key, &vec,1 , + target_node, status); +if (ret <0 ) +mlog_network_errno (ret, target_node); +return ret; }EXPORT_SYMBOL_GPL (o2net_send_message);fs/ocfs2/dlm/dlmast.c +1
-1@@ -453,7 +453,7 @@ int dlm_send_proxy_ast_msg(struct dlm_ctxt *dlm, struct dlm_lock_resource *res, ret =o2net_send_message_vec (DLM_PROXY_AST_MSG , dlm->key, vec, veclen, lock->ml.node, &status);if (ret <0 ) -mlog_errno (ret); +mlog_network_errno (ret, lock->ml.node);else {if (status ==DLM_RECOVERING ) { mlog(ML_ERROR, "sent AST to node %u, it thinks this "fs/ocfs2/dlm/dlmconvert.c +1
-1@@ -391,7 +391,7 @@ static enum dlm_status dlm_send_remote_convert_request(struct dlm_ctxt *dlm, }else if (ret !=DLM_NORMAL && ret !=DLM_NOTQUEUED )dlm_error (ret); }else { -mlog_errno (tmpret); +mlog_network_errno (tmpret, res->owner);if (dlm_is_host_down (tmpret)) {/* instead of logging the same network error over * and over, sleep here and wait for the heartbeat fs/ocfs2/dlm/dlmunlock.c +1
-1@@ -355,7 +355,7 @@ static enum dlm_status dlm_send_remote_unlock_request(struct dlm_ctxt *dlm,mlog (0 ,"master was in-progress. retry\n" ); ret = status; }else { -mlog_errno (tmpret); +mlog_network_errno (tmpret, owner);if (dlm_is_host_down (tmpret)) {/* NOTE: this seems strange, but it is what we want. * when the master goes down during a cancel or
PATCH 1/1 ocfs2: prints peer node number when sending tcp msg failed
Hi Sunil,
Quoted 4 lines · Sunil Mushran
Yes knowing the node number will be very useful.
Wondering why not just have the mlog in
o2net_send_message_vec(). Fewer changes. Do you see any downside?
No very good reason just that I think there is rule that callers print the error number returned by the callee.
If the above doesn't matter, of course your suggestion is better.
Or you meant we print the errno returned by o2net_send_tcp_msg() with node number in o2net_send_message_vec()?
regards,
wengang.
Quoted 3 lines
Quoted 2 lines · Wengang Wang
This patch adds prints of the number of peer node to which sending tcp message failed. It helps debugging.
PATCH 1/1 ocfs2: prints peer node number when sending tcp msg failed
Maybe what you are doing is better. One downside of doing it in o2net_send_message_vec() is that we'll get one additional message. And we don't want that.
But no need to add a macro. Use mlog(ML_ERROR). It will let us add more stuff to the msg.
mlog(ML_ERROR, "Unable to send message %u (key 0x%x) to node %u\n", ...);
Sunil
Quoted 22 lines · Wengang Wang
Hi Sunil,
Quoted 4 lines · Sunil Mushran
Yes knowing the node number will be very useful.
Wondering why not just have the mlog in
o2net_send_message_vec(). Fewer changes. Do you see any downside?No very good reason just that I think there is rule that callers print the error number returned by the callee.
If the above doesn't matter, of course your suggestion is better.
Or you meant we print the errno returned by
o2net_send_tcp_msg()with node number ino2net_send_message_vec()?regards,
wengang.Quoted 3 lines
Quoted 2 lines · Wengang Wang
This patch adds prints of the number of peer node to which sending tcp message failed. It helps debugging.
PATCH 1/1 ocfs2: prints peer node number when sending tcp msg failed
oops... we need the error number.
mlog(ML_ERROR, "Error %d when sending message %u (key 0x%x) to node %u\n", ...);
Quoted 47 lines · Sunil Mushran
Maybe what you are doing is better. One downside of doing it in
o2net_send_message_vec()is that we'll get one additional message. And we don't want that.But no need to add a macro. Use
mlog(ML_ERROR). It will let us add more stuff to the msg.
mlog(ML_ERROR, "Unable to send message %u (key 0x%x) to node %u\n", ...);Sunil
Quoted 12 lines · Wengang Wang
Hi Sunil,
Quoted 5 lines · Sunil Mushran
Yes knowing the node number will be very useful.
Wondering why not just have the mlog in
o2net_send_message_vec(). Fewer changes. Do you see any downside?No very good reason just that I think there is rule that callers print the error number returned by the callee.
Quoted 14 lines
If the above doesn't matter, of course your suggestion is better.
Or you meant we print the errno returned by
o2net_send_tcp_msg()with node number ino2net_send_message_vec()?regards,
wengang.Quoted 5 lines
Quoted 3 lines · Wengang Wang
This patch adds prints of the number of peer node to which sending tcp message failed. It helps debugging.
_______________________________________________
Ocfs2-devel mailing list
Ocfs2-devel at oss.oracle.com
http://oss.oracle.com/mailman/listinfo/ocfs2-devel
PATCH 1/1 ocfs2: prints peer node number when sending tcp msg failed
In reply to Sunil MushranQuoted 3 lines · Sunil Mushran
Maybe what you are doing is better. One downside of doing it in
o2net_send_message_vec()is that we'll get one additional message. And we don't want that.
If this is a consideration, I would like to print the log where o2net_send_message() is called instead of do it inside o2net_send_message().
Quoted 3 lines
But no need to add a macro. Use
mlog(ML_ERROR). It will let us add more stuff to the msg.
Ok.
Quoted 2 lines
mlog(ML_ERROR, "Error %d when sending message %u (key 0x%x) to node %u\n", ...);
Got it.
regards,
wengang.
Quoted 27 lines
Sunil
Quoted 21 lines · Wengang Wang
Hi Sunil,
Quoted 4 lines · Sunil Mushran
Yes knowing the node number will be very useful.
Wondering why not just have the mlog in
o2net_send_message_vec(). Fewer changes. Do you see any downside?No very good reason just that I think there is rule that callers print the error number returned by the callee.
If the above doesn't matter, of course your suggestion is better.
Or you meant we print the errno returned by
o2net_send_tcp_msg()with node number ino2net_send_message_vec()?regards,
wengang.Quoted 3 lines
Quoted 2 lines · Wengang Wang
This patch adds prints of the number of peer node to which sending tcp message failed. It helps debugging.