aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGoldwyn Rodrigues <rgoldwyn@suse.de>2014-01-21 18:48:22 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2014-01-21 19:19:41 -0500
commit66e188fc3173eaeb32d3479758685e34889aff14 (patch)
treea1ce65f346ec0290985dcbff78402d2f03d9edf4
parentc74a3bdd9b529d924d1abf986079b783dd105ace (diff)
ocfs2: add DLM recovery callbacks
These are the callbacks called by the fs/dlm code in case the membership changes. If there is a failure while/during calling any of these, the DLM creates a new membership and relays to the rest of the nodes. - recover_prep() is called when DLM understands a node is down. - recover_slot() is called once all nodes have acknowledged recover_prep and recovery can begin. - recover_done() is called once the recovery is complete. It returns the new membership. Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com> Reviewed-by: Mark Fasheh <mfasheh@suse.de> Cc: Joel Becker <jlbec@evilplan.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/ocfs2/stack_user.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c
index 286edf1e231f..4111855a4def 100644
--- a/fs/ocfs2/stack_user.c
+++ b/fs/ocfs2/stack_user.c
@@ -110,6 +110,8 @@
110struct ocfs2_live_connection { 110struct ocfs2_live_connection {
111 struct list_head oc_list; 111 struct list_head oc_list;
112 struct ocfs2_cluster_connection *oc_conn; 112 struct ocfs2_cluster_connection *oc_conn;
113 atomic_t oc_this_node;
114 int oc_our_slot;
113}; 115};
114 116
115struct ocfs2_control_private { 117struct ocfs2_control_private {
@@ -799,6 +801,42 @@ static int fs_protocol_compare(struct ocfs2_protocol_version *existing,
799 return 0; 801 return 0;
800} 802}
801 803
804static void user_recover_prep(void *arg)
805{
806}
807
808static void user_recover_slot(void *arg, struct dlm_slot *slot)
809{
810 struct ocfs2_cluster_connection *conn = arg;
811 printk(KERN_INFO "ocfs2: Node %d/%d down. Initiating recovery.\n",
812 slot->nodeid, slot->slot);
813 conn->cc_recovery_handler(slot->nodeid, conn->cc_recovery_data);
814
815}
816
817static void user_recover_done(void *arg, struct dlm_slot *slots,
818 int num_slots, int our_slot,
819 uint32_t generation)
820{
821 struct ocfs2_cluster_connection *conn = arg;
822 struct ocfs2_live_connection *lc = conn->cc_private;
823 int i;
824
825 for (i = 0; i < num_slots; i++)
826 if (slots[i].slot == our_slot) {
827 atomic_set(&lc->oc_this_node, slots[i].nodeid);
828 break;
829 }
830
831 lc->oc_our_slot = our_slot;
832}
833
834const struct dlm_lockspace_ops ocfs2_ls_ops = {
835 .recover_prep = user_recover_prep,
836 .recover_slot = user_recover_slot,
837 .recover_done = user_recover_done,
838};
839
802static int user_cluster_connect(struct ocfs2_cluster_connection *conn) 840static int user_cluster_connect(struct ocfs2_cluster_connection *conn)
803{ 841{
804 dlm_lockspace_t *fsdlm; 842 dlm_lockspace_t *fsdlm;