mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-25 21:24:08 +08:00
489d8e559c
This patch introduce to make a tcp lowcomms connection reliable even if reconnects occurs. This is done by an application layer re-transmission handling and sequence numbers in dlm protocols. There are three new dlm commands: DLM_OPTS: This will encapsulate an existing dlm message (and rcom message if they don't have an own application side re-transmission handling). As optional handling additional tlv's (type length fields) can be appended. This can be for example a sequence number field. However because in DLM_OPTS the lockspace field is unused and a sequence number is a mandatory field it isn't made as a tlv and we put the sequence number inside the lockspace id. The possibility to add optional options are still there for future purposes. DLM_ACK: Just a dlm header to acknowledge the receive of a DLM_OPTS message to it's sender. DLM_FIN: This provides a 4 way handshake for connection termination inclusive support for half-closed connections. It's provided on application layer because SCTP doesn't support half-closed sockets, the shutdown() call can interrupted by e.g. TCP resets itself and a hard logic to implement it because the othercon paradigm in lowcomms. The 4-way termination handshake also solve problems to synchronize peer EOF arrival and that the cluster manager removes the peer in the node membership handling of DLM. In some cases messages can be still transmitted in this time and we need to wait for the node membership event. To provide a reliable connection the node will retransmit all unacknowledges message to it's peer on reconnect. The receiver will then filtering out the next received message and drop all messages which are duplicates. As RCOM_STATUS and RCOM_NAMES messages are the first messages which are exchanged and they have they own re-transmission handling, there exists logic that these messages must be first. If these messages arrives we store the dlm version field. This handling is on DLM 3.1 and after this patch 3.2 the same. A backwards compatibility handling has been added which seems to work on tests without tcpkill, however it's not recommended to use DLM 3.1 and 3.2 at the same time, because DLM 3.2 tries to fix long term bugs in the DLM protocol. Signed-off-by: Alexander Aring <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
52 lines
1.7 KiB
C
52 lines
1.7 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/******************************************************************************
|
|
*******************************************************************************
|
|
**
|
|
** Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
|
|
** Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved.
|
|
**
|
|
**
|
|
*******************************************************************************
|
|
******************************************************************************/
|
|
|
|
#ifndef __LOWCOMMS_DOT_H__
|
|
#define __LOWCOMMS_DOT_H__
|
|
|
|
#include "dlm_internal.h"
|
|
|
|
#define DLM_MIDCOMMS_OPT_LEN sizeof(struct dlm_opts)
|
|
#define LOWCOMMS_MAX_TX_BUFFER_LEN (DEFAULT_BUFFER_SIZE - \
|
|
DLM_MIDCOMMS_OPT_LEN)
|
|
|
|
#define CONN_HASH_SIZE 32
|
|
|
|
/* This is deliberately very simple because most clusters have simple
|
|
* sequential nodeids, so we should be able to go straight to a connection
|
|
* struct in the array
|
|
*/
|
|
static inline int nodeid_hash(int nodeid)
|
|
{
|
|
return nodeid & (CONN_HASH_SIZE-1);
|
|
}
|
|
|
|
/* switch to check if dlm is running */
|
|
extern int dlm_allow_conn;
|
|
|
|
int dlm_lowcomms_start(void);
|
|
void dlm_lowcomms_shutdown(void);
|
|
void dlm_lowcomms_stop(void);
|
|
void dlm_lowcomms_exit(void);
|
|
int dlm_lowcomms_close(int nodeid);
|
|
struct dlm_msg *dlm_lowcomms_new_msg(int nodeid, int len, gfp_t allocation,
|
|
char **ppc, void (*cb)(struct dlm_mhandle *mh),
|
|
struct dlm_mhandle *mh);
|
|
void dlm_lowcomms_commit_msg(struct dlm_msg *msg);
|
|
void dlm_lowcomms_put_msg(struct dlm_msg *msg);
|
|
int dlm_lowcomms_resend_msg(struct dlm_msg *msg);
|
|
int dlm_lowcomms_connect_node(int nodeid);
|
|
int dlm_lowcomms_nodes_set_mark(int nodeid, unsigned int mark);
|
|
int dlm_lowcomms_addr(int nodeid, struct sockaddr_storage *addr, int len);
|
|
|
|
#endif /* __LOWCOMMS_DOT_H__ */
|
|
|