aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ocfs2/dlm/dlmdomain.c
diff options
context:
space:
mode:
authorKurt Hackel <kurt.hackel@oracle.com>2007-01-17 20:04:25 -0500
committerMark Fasheh <mark.fasheh@oracle.com>2007-02-07 15:06:56 -0500
commitd74c9803a90d733f5fb7270475aa6d14b45796c6 (patch)
tree7f402437667103773cfe7d76b56a621183e84094 /fs/ocfs2/dlm/dlmdomain.c
parent74aa25856c693d20a886cdb31a004aaca411d135 (diff)
ocfs2: Added post handler callable function in o2net message handler
Currently o2net allows one handler function per message type. This patch adds the ability to call another function to be called after the handler has returned the message to the other node. Handlers are now given the option of returning a context (in the form of a void **) which will be passed back into the post message handler function. Signed-off-by: Kurt Hackel <kurt.hackel@oracle.com> Signed-off-by: Sunil Mushran <sunil.mushran@oracle.com> Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>
Diffstat (limited to 'fs/ocfs2/dlm/dlmdomain.c')
-rw-r--r--fs/ocfs2/dlm/dlmdomain.c60
1 files changed, 34 insertions, 26 deletions
diff --git a/fs/ocfs2/dlm/dlmdomain.c b/fs/ocfs2/dlm/dlmdomain.c
index 3995de360264..8a208b06fdd7 100644
--- a/fs/ocfs2/dlm/dlmdomain.c
+++ b/fs/ocfs2/dlm/dlmdomain.c
@@ -95,10 +95,14 @@ static DECLARE_WAIT_QUEUE_HEAD(dlm_domain_events);
95 95
96#define DLM_DOMAIN_BACKOFF_MS 200 96#define DLM_DOMAIN_BACKOFF_MS 200
97 97
98static int dlm_query_join_handler(struct o2net_msg *msg, u32 len, void *data); 98static int dlm_query_join_handler(struct o2net_msg *msg, u32 len, void *data,
99static int dlm_assert_joined_handler(struct o2net_msg *msg, u32 len, void *data); 99 void **ret_data);
100static int dlm_cancel_join_handler(struct o2net_msg *msg, u32 len, void *data); 100static int dlm_assert_joined_handler(struct o2net_msg *msg, u32 len, void *data,
101static int dlm_exit_domain_handler(struct o2net_msg *msg, u32 len, void *data); 101 void **ret_data);
102static int dlm_cancel_join_handler(struct o2net_msg *msg, u32 len, void *data,
103 void **ret_data);
104static int dlm_exit_domain_handler(struct o2net_msg *msg, u32 len, void *data,
105 void **ret_data);
102 106
103static void dlm_unregister_domain_handlers(struct dlm_ctxt *dlm); 107static void dlm_unregister_domain_handlers(struct dlm_ctxt *dlm);
104 108
@@ -466,7 +470,8 @@ static void __dlm_print_nodes(struct dlm_ctxt *dlm)
466 printk("\n"); 470 printk("\n");
467} 471}
468 472
469static int dlm_exit_domain_handler(struct o2net_msg *msg, u32 len, void *data) 473static int dlm_exit_domain_handler(struct o2net_msg *msg, u32 len, void *data,
474 void **ret_data)
470{ 475{
471 struct dlm_ctxt *dlm = data; 476 struct dlm_ctxt *dlm = data;
472 unsigned int node; 477 unsigned int node;
@@ -630,7 +635,8 @@ void dlm_unregister_domain(struct dlm_ctxt *dlm)
630} 635}
631EXPORT_SYMBOL_GPL(dlm_unregister_domain); 636EXPORT_SYMBOL_GPL(dlm_unregister_domain);
632 637
633static int dlm_query_join_handler(struct o2net_msg *msg, u32 len, void *data) 638static int dlm_query_join_handler(struct o2net_msg *msg, u32 len, void *data,
639 void **ret_data)
634{ 640{
635 struct dlm_query_join_request *query; 641 struct dlm_query_join_request *query;
636 enum dlm_query_join_response response; 642 enum dlm_query_join_response response;
@@ -707,7 +713,8 @@ respond:
707 return response; 713 return response;
708} 714}
709 715
710static int dlm_assert_joined_handler(struct o2net_msg *msg, u32 len, void *data) 716static int dlm_assert_joined_handler(struct o2net_msg *msg, u32 len, void *data,
717 void **ret_data)
711{ 718{
712 struct dlm_assert_joined *assert; 719 struct dlm_assert_joined *assert;
713 struct dlm_ctxt *dlm = NULL; 720 struct dlm_ctxt *dlm = NULL;
@@ -744,7 +751,8 @@ static int dlm_assert_joined_handler(struct o2net_msg *msg, u32 len, void *data)
744 return 0; 751 return 0;
745} 752}
746 753
747static int dlm_cancel_join_handler(struct o2net_msg *msg, u32 len, void *data) 754static int dlm_cancel_join_handler(struct o2net_msg *msg, u32 len, void *data,
755 void **ret_data)
748{ 756{
749 struct dlm_cancel_join *cancel; 757 struct dlm_cancel_join *cancel;
750 struct dlm_ctxt *dlm = NULL; 758 struct dlm_ctxt *dlm = NULL;
@@ -1086,105 +1094,105 @@ static int dlm_register_domain_handlers(struct dlm_ctxt *dlm)
1086 status = o2net_register_handler(DLM_MASTER_REQUEST_MSG, dlm->key, 1094 status = o2net_register_handler(DLM_MASTER_REQUEST_MSG, dlm->key,
1087 sizeof(struct dlm_master_request), 1095 sizeof(struct dlm_master_request),
1088 dlm_master_request_handler, 1096 dlm_master_request_handler,
1089 dlm, &dlm->dlm_domain_handlers); 1097 dlm, NULL, &dlm->dlm_domain_handlers);
1090 if (status) 1098 if (status)
1091 goto bail; 1099 goto bail;
1092 1100
1093 status = o2net_register_handler(DLM_ASSERT_MASTER_MSG, dlm->key, 1101 status = o2net_register_handler(DLM_ASSERT_MASTER_MSG, dlm->key,
1094 sizeof(struct dlm_assert_master), 1102 sizeof(struct dlm_assert_master),
1095 dlm_assert_master_handler, 1103 dlm_assert_master_handler,
1096 dlm, &dlm->dlm_domain_handlers); 1104 dlm, NULL, &dlm->dlm_domain_handlers);
1097 if (status) 1105 if (status)
1098 goto bail; 1106 goto bail;
1099 1107
1100 status = o2net_register_handler(DLM_CREATE_LOCK_MSG, dlm->key, 1108 status = o2net_register_handler(DLM_CREATE_LOCK_MSG, dlm->key,
1101 sizeof(struct dlm_create_lock), 1109 sizeof(struct dlm_create_lock),
1102 dlm_create_lock_handler, 1110 dlm_create_lock_handler,
1103 dlm, &dlm->dlm_domain_handlers); 1111 dlm, NULL, &dlm->dlm_domain_handlers);
1104 if (status) 1112 if (status)
1105 goto bail; 1113 goto bail;
1106 1114
1107 status = o2net_register_handler(DLM_CONVERT_LOCK_MSG, dlm->key, 1115 status = o2net_register_handler(DLM_CONVERT_LOCK_MSG, dlm->key,
1108 DLM_CONVERT_LOCK_MAX_LEN, 1116 DLM_CONVERT_LOCK_MAX_LEN,
1109 dlm_convert_lock_handler, 1117 dlm_convert_lock_handler,
1110 dlm, &dlm->dlm_domain_handlers); 1118 dlm, NULL, &dlm->dlm_domain_handlers);
1111 if (status) 1119 if (status)
1112 goto bail; 1120 goto bail;
1113 1121
1114 status = o2net_register_handler(DLM_UNLOCK_LOCK_MSG, dlm->key, 1122 status = o2net_register_handler(DLM_UNLOCK_LOCK_MSG, dlm->key,
1115 DLM_UNLOCK_LOCK_MAX_LEN, 1123 DLM_UNLOCK_LOCK_MAX_LEN,
1116 dlm_unlock_lock_handler, 1124 dlm_unlock_lock_handler,
1117 dlm, &dlm->dlm_domain_handlers); 1125 dlm, NULL, &dlm->dlm_domain_handlers);
1118 if (status) 1126 if (status)
1119 goto bail; 1127 goto bail;
1120 1128
1121 status = o2net_register_handler(DLM_PROXY_AST_MSG, dlm->key, 1129 status = o2net_register_handler(DLM_PROXY_AST_MSG, dlm->key,
1122 DLM_PROXY_AST_MAX_LEN, 1130 DLM_PROXY_AST_MAX_LEN,
1123 dlm_proxy_ast_handler, 1131 dlm_proxy_ast_handler,
1124 dlm, &dlm->dlm_domain_handlers); 1132 dlm, NULL, &dlm->dlm_domain_handlers);
1125 if (status) 1133 if (status)
1126 goto bail; 1134 goto bail;
1127 1135
1128 status = o2net_register_handler(DLM_EXIT_DOMAIN_MSG, dlm->key, 1136 status = o2net_register_handler(DLM_EXIT_DOMAIN_MSG, dlm->key,
1129 sizeof(struct dlm_exit_domain), 1137 sizeof(struct dlm_exit_domain),
1130 dlm_exit_domain_handler, 1138 dlm_exit_domain_handler,
1131 dlm, &dlm->dlm_domain_handlers); 1139 dlm, NULL, &dlm->dlm_domain_handlers);
1132 if (status) 1140 if (status)
1133 goto bail; 1141 goto bail;
1134 1142
1135 status = o2net_register_handler(DLM_DEREF_LOCKRES_MSG, dlm->key, 1143 status = o2net_register_handler(DLM_DEREF_LOCKRES_MSG, dlm->key,
1136 sizeof(struct dlm_deref_lockres), 1144 sizeof(struct dlm_deref_lockres),
1137 dlm_deref_lockres_handler, 1145 dlm_deref_lockres_handler,
1138 dlm, &dlm->dlm_domain_handlers); 1146 dlm, NULL, &dlm->dlm_domain_handlers);
1139 if (status) 1147 if (status)
1140 goto bail; 1148 goto bail;
1141 1149
1142 status = o2net_register_handler(DLM_MIGRATE_REQUEST_MSG, dlm->key, 1150 status = o2net_register_handler(DLM_MIGRATE_REQUEST_MSG, dlm->key,
1143 sizeof(struct dlm_migrate_request), 1151 sizeof(struct dlm_migrate_request),
1144 dlm_migrate_request_handler, 1152 dlm_migrate_request_handler,
1145 dlm, &dlm->dlm_domain_handlers); 1153 dlm, NULL, &dlm->dlm_domain_handlers);
1146 if (status) 1154 if (status)
1147 goto bail; 1155 goto bail;
1148 1156
1149 status = o2net_register_handler(DLM_MIG_LOCKRES_MSG, dlm->key, 1157 status = o2net_register_handler(DLM_MIG_LOCKRES_MSG, dlm->key,
1150 DLM_MIG_LOCKRES_MAX_LEN, 1158 DLM_MIG_LOCKRES_MAX_LEN,
1151 dlm_mig_lockres_handler, 1159 dlm_mig_lockres_handler,
1152 dlm, &dlm->dlm_domain_handlers); 1160 dlm, NULL, &dlm->dlm_domain_handlers);
1153 if (status) 1161 if (status)
1154 goto bail; 1162 goto bail;
1155 1163
1156 status = o2net_register_handler(DLM_MASTER_REQUERY_MSG, dlm->key, 1164 status = o2net_register_handler(DLM_MASTER_REQUERY_MSG, dlm->key,
1157 sizeof(struct dlm_master_requery), 1165 sizeof(struct dlm_master_requery),
1158 dlm_master_requery_handler, 1166 dlm_master_requery_handler,
1159 dlm, &dlm->dlm_domain_handlers); 1167 dlm, NULL, &dlm->dlm_domain_handlers);
1160 if (status) 1168 if (status)
1161 goto bail; 1169 goto bail;
1162 1170
1163 status = o2net_register_handler(DLM_LOCK_REQUEST_MSG, dlm->key, 1171 status = o2net_register_handler(DLM_LOCK_REQUEST_MSG, dlm->key,
1164 sizeof(struct dlm_lock_request), 1172 sizeof(struct dlm_lock_request),
1165 dlm_request_all_locks_handler, 1173 dlm_request_all_locks_handler,
1166 dlm, &dlm->dlm_domain_handlers); 1174 dlm, NULL, &dlm->dlm_domain_handlers);
1167 if (status) 1175 if (status)
1168 goto bail; 1176 goto bail;
1169 1177
1170 status = o2net_register_handler(DLM_RECO_DATA_DONE_MSG, dlm->key, 1178 status = o2net_register_handler(DLM_RECO_DATA_DONE_MSG, dlm->key,
1171 sizeof(struct dlm_reco_data_done), 1179 sizeof(struct dlm_reco_data_done),
1172 dlm_reco_data_done_handler, 1180 dlm_reco_data_done_handler,
1173 dlm, &dlm->dlm_domain_handlers); 1181 dlm, NULL, &dlm->dlm_domain_handlers);
1174 if (status) 1182 if (status)
1175 goto bail; 1183 goto bail;
1176 1184
1177 status = o2net_register_handler(DLM_BEGIN_RECO_MSG, dlm->key, 1185 status = o2net_register_handler(DLM_BEGIN_RECO_MSG, dlm->key,
1178 sizeof(struct dlm_begin_reco), 1186 sizeof(struct dlm_begin_reco),
1179 dlm_begin_reco_handler, 1187 dlm_begin_reco_handler,
1180 dlm, &dlm->dlm_domain_handlers); 1188 dlm, NULL, &dlm->dlm_domain_handlers);
1181 if (status) 1189 if (status)
1182 goto bail; 1190 goto bail;
1183 1191
1184 status = o2net_register_handler(DLM_FINALIZE_RECO_MSG, dlm->key, 1192 status = o2net_register_handler(DLM_FINALIZE_RECO_MSG, dlm->key,
1185 sizeof(struct dlm_finalize_reco), 1193 sizeof(struct dlm_finalize_reco),
1186 dlm_finalize_reco_handler, 1194 dlm_finalize_reco_handler,
1187 dlm, &dlm->dlm_domain_handlers); 1195 dlm, NULL, &dlm->dlm_domain_handlers);
1188 if (status) 1196 if (status)
1189 goto bail; 1197 goto bail;
1190 1198
@@ -1478,21 +1486,21 @@ static int dlm_register_net_handlers(void)
1478 status = o2net_register_handler(DLM_QUERY_JOIN_MSG, DLM_MOD_KEY, 1486 status = o2net_register_handler(DLM_QUERY_JOIN_MSG, DLM_MOD_KEY,
1479 sizeof(struct dlm_query_join_request), 1487 sizeof(struct dlm_query_join_request),
1480 dlm_query_join_handler, 1488 dlm_query_join_handler,
1481 NULL, &dlm_join_handlers); 1489 NULL, NULL, &dlm_join_handlers);
1482 if (status) 1490 if (status)
1483 goto bail; 1491 goto bail;
1484 1492
1485 status = o2net_register_handler(DLM_ASSERT_JOINED_MSG, DLM_MOD_KEY, 1493 status = o2net_register_handler(DLM_ASSERT_JOINED_MSG, DLM_MOD_KEY,
1486 sizeof(struct dlm_assert_joined), 1494 sizeof(struct dlm_assert_joined),
1487 dlm_assert_joined_handler, 1495 dlm_assert_joined_handler,
1488 NULL, &dlm_join_handlers); 1496 NULL, NULL, &dlm_join_handlers);
1489 if (status) 1497 if (status)
1490 goto bail; 1498 goto bail;
1491 1499
1492 status = o2net_register_handler(DLM_CANCEL_JOIN_MSG, DLM_MOD_KEY, 1500 status = o2net_register_handler(DLM_CANCEL_JOIN_MSG, DLM_MOD_KEY,
1493 sizeof(struct dlm_cancel_join), 1501 sizeof(struct dlm_cancel_join),
1494 dlm_cancel_join_handler, 1502 dlm_cancel_join_handler,
1495 NULL, &dlm_join_handlers); 1503 NULL, NULL, &dlm_join_handlers);
1496 1504
1497bail: 1505bail:
1498 if (status < 0) 1506 if (status < 0)