Commit a070a91c authored by Alexander Aring's avatar Alexander Aring Committed by David Teigland
Browse files

fs: dlm: add more midcomms hooks



This patch prepares hooks to redirect to the midcomms layer which will
be used by the midcomms re-transmit handling.

There exists the new concept of stateless buffers allocation and
commits. This can be used to bypass the midcomms re-transmit handling. It
is used by RCOM_STATUS and RCOM_NAMES messages, because they have their
own ping-like re-transmit handling. As well these two messages will be
used to determine the DLM version per node, because these two messages
are per observation the first messages which are exchanged.

Cluster manager events for node membership are added to add support for
half-closed connections in cases that the peer connection get to
an end of file but DLM still holds membership of the node. In
this time DLM can still trigger new message which we should allow. After
the cluster manager node removal event occurs it safe to close the
connection.

Signed-off-by: default avatarAlexander Aring <aahringo@redhat.com>
Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
parent 6fb5cf9d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include <net/sock.h>

#include "config.h"
#include "midcomms.h"
#include "lowcomms.h"

/*
@@ -532,7 +533,7 @@ static void drop_comm(struct config_group *g, struct config_item *i)
	struct dlm_comm *cm = config_item_to_comm(i);
	if (local_comm == cm)
		local_comm = NULL;
	dlm_lowcomms_close(cm->nodeid);
	dlm_midcomms_close(cm->nodeid);
	while (cm->addr_count--)
		kfree(cm->addr[cm->addr_count]);
	config_item_put(i);
+4 −4
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@
#include "dlm_internal.h"
#include <linux/dlm_device.h>
#include "memory.h"
#include "lowcomms.h"
#include "midcomms.h"
#include "requestqueue.h"
#include "util.h"
#include "dir.h"
@@ -3534,10 +3534,10 @@ static int _create_message(struct dlm_ls *ls, int mb_len,
	char *mb;

	/* get_buffer gives us a message handle (mh) that we need to
	   pass into lowcomms_commit and a message buffer (mb) that we
	   pass into midcomms_commit and a message buffer (mb) that we
	   write our data into */

	mh = dlm_lowcomms_get_buffer(to_nodeid, mb_len, GFP_NOFS, &mb);
	mh = dlm_midcomms_get_mhandle(to_nodeid, mb_len, GFP_NOFS, &mb);
	if (!mh)
		return -ENOBUFS;

@@ -3589,7 +3589,7 @@ static int create_message(struct dlm_rsb *r, struct dlm_lkb *lkb,
static int send_message(struct dlm_mhandle *mh, struct dlm_message *ms)
{
	dlm_message_out(ms);
	dlm_lowcomms_commit_buffer(mh);
	dlm_midcomms_commit_mhandle(mh);
	return 0;
}

+4 −3
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
#include "member.h"
#include "recoverd.h"
#include "dir.h"
#include "midcomms.h"
#include "lowcomms.h"
#include "config.h"
#include "memory.h"
@@ -390,7 +391,7 @@ static int threads_start(void)
	}

	/* Thread for sending/receiving messages for all lockspace's */
	error = dlm_lowcomms_start();
	error = dlm_midcomms_start();
	if (error) {
		log_print("cannot start dlm lowcomms %d", error);
		goto scand_fail;
@@ -698,7 +699,7 @@ int dlm_new_lockspace(const char *name, const char *cluster,
		error = 0;
	if (!ls_count) {
		dlm_scand_stop();
		dlm_lowcomms_shutdown();
		dlm_midcomms_shutdown();
		dlm_lowcomms_stop();
	}
 out:
@@ -787,7 +788,7 @@ static int release_lockspace(struct dlm_ls *ls, int force)

	if (ls_count == 1) {
		dlm_scand_stop();
		dlm_lowcomms_shutdown();
		dlm_midcomms_shutdown();
	}

	dlm_callback_stop(ls);
+14 −3
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
#include "recover.h"
#include "rcom.h"
#include "config.h"
#include "midcomms.h"
#include "lowcomms.h"

int dlm_slots_version(struct dlm_header *h)
@@ -329,6 +330,7 @@ static int dlm_add_member(struct dlm_ls *ls, struct dlm_config_node *node)
	memb->nodeid = node->nodeid;
	memb->weight = node->weight;
	memb->comm_seq = node->comm_seq;
	dlm_midcomms_add_member(node->nodeid);
	add_ordered_member(ls, memb);
	ls->ls_num_nodes++;
	return 0;
@@ -359,26 +361,34 @@ int dlm_is_removed(struct dlm_ls *ls, int nodeid)
	return 0;
}

static void clear_memb_list(struct list_head *head)
static void clear_memb_list(struct list_head *head,
			    void (*after_del)(int nodeid))
{
	struct dlm_member *memb;

	while (!list_empty(head)) {
		memb = list_entry(head->next, struct dlm_member, list);
		list_del(&memb->list);
		if (after_del)
			after_del(memb->nodeid);
		kfree(memb);
	}
}

static void clear_members_cb(int nodeid)
{
	dlm_midcomms_remove_member(nodeid);
}

void dlm_clear_members(struct dlm_ls *ls)
{
	clear_memb_list(&ls->ls_nodes);
	clear_memb_list(&ls->ls_nodes, clear_members_cb);
	ls->ls_num_nodes = 0;
}

void dlm_clear_members_gone(struct dlm_ls *ls)
{
	clear_memb_list(&ls->ls_nodes_gone);
	clear_memb_list(&ls->ls_nodes_gone, NULL);
}

static void make_member_array(struct dlm_ls *ls)
@@ -552,6 +562,7 @@ int dlm_recover_members(struct dlm_ls *ls, struct dlm_recover *rv, int *neg_out)

		neg++;
		list_move(&memb->list, &ls->ls_nodes_gone);
		dlm_midcomms_remove_member(memb->nodeid);
		ls->ls_num_nodes--;
		dlm_lsop_recover_slot(ls, memb);
	}
+30 −1
Original line number Diff line number Diff line
@@ -28,6 +28,36 @@
#include "lock.h"
#include "midcomms.h"

struct dlm_mhandle *dlm_midcomms_get_mhandle(int nodeid, int len,
					     gfp_t allocation, char **ppc)
{
	return dlm_lowcomms_get_buffer(nodeid, len, allocation, ppc);
}

void dlm_midcomms_commit_mhandle(struct dlm_mhandle *mh)
{
	dlm_lowcomms_commit_buffer(mh);
}

void dlm_midcomms_add_member(int nodeid) { }

void dlm_midcomms_remove_member(int nodeid) { }

int dlm_midcomms_start(void)
{
	return dlm_lowcomms_start();
}

void dlm_midcomms_shutdown(void)
{
	dlm_lowcomms_shutdown();
}

int dlm_midcomms_close(int nodeid)
{
	return dlm_lowcomms_close(nodeid);
}

/*
 * Called from the low-level comms layer to process a buffer of
 * commands.
@@ -101,4 +131,3 @@ int dlm_process_incoming_buffer(int nodeid, unsigned char *buf, int len)

	return ret;
}
Loading