Skip to content

Commit 66e188f

Browse files
Goldwyn Rodriguestorvalds
authored andcommitted
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>
1 parent c74a3bd commit 66e188f

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

fs/ocfs2/stack_user.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@
110110
struct ocfs2_live_connection {
111111
struct list_head oc_list;
112112
struct ocfs2_cluster_connection *oc_conn;
113+
atomic_t oc_this_node;
114+
int oc_our_slot;
113115
};
114116

115117
struct ocfs2_control_private {
@@ -799,6 +801,42 @@ static int fs_protocol_compare(struct ocfs2_protocol_version *existing,
799801
return 0;
800802
}
801803

804+
static void user_recover_prep(void *arg)
805+
{
806+
}
807+
808+
static 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+
817+
static 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+
834+
const 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+
802840
static int user_cluster_connect(struct ocfs2_cluster_connection *conn)
803841
{
804842
dlm_lockspace_t *fsdlm;

0 commit comments

Comments
 (0)