Commit 265113f7 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'dlm-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm

Pull dlm updates from David Teigland:
 "This set includes a number of minor fixes and cleanups related to the
  networking changes in the last release.

  A patch to delay ack messages reduces network traffic significantly"

* tag 'dlm-5.15' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/linux-dlm:
  fs: dlm: avoid comms shutdown delay in release_lockspace
  fs: dlm: fix return -EINTR on recovery stopped
  fs: dlm: implement delayed ack handling
  fs: dlm: move receive loop into receive handler
  fs: dlm: fix multiple empty writequeue alloc
  fs: dlm: generic connect func
  fs: dlm: auto load sctp module
  fs: dlm: introduce generic listen
  fs: dlm: move to static proto ops
  fs: dlm: introduce con_next_wq helper
  fs: dlm: cleanup and remove _send_rcom
  fs: dlm: clear CF_APP_LIMITED on close
  fs: dlm: fix typo in tlv prefix
  fs: dlm: use READ_ONCE for config var
  fs: dlm: use sk->sk_socket instead of con->sock
parents b0cfcdd9 ecd95673
...@@ -85,8 +85,10 @@ int dlm_recover_directory(struct dlm_ls *ls) ...@@ -85,8 +85,10 @@ int dlm_recover_directory(struct dlm_ls *ls)
for (;;) { for (;;) {
int left; int left;
error = dlm_recovery_stopped(ls); error = dlm_recovery_stopped(ls);
if (error) if (error) {
error = -EINTR;
goto out_free; goto out_free;
}
error = dlm_rcom_names(ls, memb->nodeid, error = dlm_rcom_names(ls, memb->nodeid,
last_name, last_len); last_name, last_len);
......
...@@ -468,7 +468,7 @@ struct dlm_rcom { ...@@ -468,7 +468,7 @@ struct dlm_rcom {
struct dlm_opt_header { struct dlm_opt_header {
uint16_t t_type; uint16_t t_type;
uint16_t t_length; uint16_t t_length;
uint32_t o_pad; uint32_t t_pad;
/* need to be 8 byte aligned */ /* need to be 8 byte aligned */
char t_value[]; char t_value[];
}; };
......
...@@ -498,7 +498,7 @@ static int new_lockspace(const char *name, const char *cluster, ...@@ -498,7 +498,7 @@ static int new_lockspace(const char *name, const char *cluster,
ls->ls_exflags = (flags & ~(DLM_LSFL_TIMEWARN | DLM_LSFL_FS | ls->ls_exflags = (flags & ~(DLM_LSFL_TIMEWARN | DLM_LSFL_FS |
DLM_LSFL_NEWEXCL)); DLM_LSFL_NEWEXCL));
size = dlm_config.ci_rsbtbl_size; size = READ_ONCE(dlm_config.ci_rsbtbl_size);
ls->ls_rsbtbl_size = size; ls->ls_rsbtbl_size = size;
ls->ls_rsbtbl = vmalloc(array_size(size, sizeof(struct dlm_rsbtable))); ls->ls_rsbtbl = vmalloc(array_size(size, sizeof(struct dlm_rsbtable)));
...@@ -793,6 +793,7 @@ static int release_lockspace(struct dlm_ls *ls, int force) ...@@ -793,6 +793,7 @@ static int release_lockspace(struct dlm_ls *ls, int force)
if (ls_count == 1) { if (ls_count == 1) {
dlm_scand_stop(); dlm_scand_stop();
dlm_clear_members(ls);
dlm_midcomms_shutdown(); dlm_midcomms_shutdown();
} }
......
This diff is collapsed.
...@@ -46,6 +46,7 @@ int dlm_lowcomms_resend_msg(struct dlm_msg *msg); ...@@ -46,6 +46,7 @@ int dlm_lowcomms_resend_msg(struct dlm_msg *msg);
int dlm_lowcomms_connect_node(int nodeid); int dlm_lowcomms_connect_node(int nodeid);
int dlm_lowcomms_nodes_set_mark(int nodeid, unsigned int mark); int dlm_lowcomms_nodes_set_mark(int nodeid, unsigned int mark);
int dlm_lowcomms_addr(int nodeid, struct sockaddr_storage *addr, int len); int dlm_lowcomms_addr(int nodeid, struct sockaddr_storage *addr, int len);
void dlm_midcomms_receive_done(int nodeid);
#endif /* __LOWCOMMS_DOT_H__ */ #endif /* __LOWCOMMS_DOT_H__ */
...@@ -443,8 +443,10 @@ static int ping_members(struct dlm_ls *ls) ...@@ -443,8 +443,10 @@ static int ping_members(struct dlm_ls *ls)
list_for_each_entry(memb, &ls->ls_nodes, list) { list_for_each_entry(memb, &ls->ls_nodes, list) {
error = dlm_recovery_stopped(ls); error = dlm_recovery_stopped(ls);
if (error) if (error) {
error = -EINTR;
break; break;
}
error = dlm_rcom_status(ls, memb->nodeid, 0); error = dlm_rcom_status(ls, memb->nodeid, 0);
if (error) if (error)
break; break;
......
...@@ -109,12 +109,6 @@ ...@@ -109,12 +109,6 @@
* compatibility. There exists better ways to make a better handling. * compatibility. There exists better ways to make a better handling.
* However this should be changed in the next major version bump of dlm. * However this should be changed in the next major version bump of dlm.
* *
* Ack handling:
*
* Currently we send an ack message for every dlm message. However we
* can ack multiple dlm messages with one ack by just delaying the ack
* message. Will reduce some traffic but makes the drop detection slower.
*
* Tail Size checking: * Tail Size checking:
* *
* There exists a message tail payload in e.g. DLM_MSG however we don't * There exists a message tail payload in e.g. DLM_MSG however we don't
...@@ -169,6 +163,7 @@ struct midcomms_node { ...@@ -169,6 +163,7 @@ struct midcomms_node {
#define DLM_NODE_FLAG_CLOSE 1 #define DLM_NODE_FLAG_CLOSE 1
#define DLM_NODE_FLAG_STOP_TX 2 #define DLM_NODE_FLAG_STOP_TX 2
#define DLM_NODE_FLAG_STOP_RX 3 #define DLM_NODE_FLAG_STOP_RX 3
#define DLM_NODE_ULP_DELIVERED 4
unsigned long flags; unsigned long flags;
wait_queue_head_t shutdown_wait; wait_queue_head_t shutdown_wait;
...@@ -480,11 +475,12 @@ static void dlm_midcomms_receive_buffer(union dlm_packet *p, ...@@ -480,11 +475,12 @@ static void dlm_midcomms_receive_buffer(union dlm_packet *p,
{ {
if (seq == node->seq_next) { if (seq == node->seq_next) {
node->seq_next++; node->seq_next++;
/* send ack before fin */
dlm_send_ack(node->nodeid, node->seq_next);
switch (p->header.h_cmd) { switch (p->header.h_cmd) {
case DLM_FIN: case DLM_FIN:
/* send ack before fin */
dlm_send_ack(node->nodeid, node->seq_next);
spin_lock(&node->state_lock); spin_lock(&node->state_lock);
pr_debug("receive fin msg from node %d with state %s\n", pr_debug("receive fin msg from node %d with state %s\n",
node->nodeid, dlm_state_str(node->state)); node->nodeid, dlm_state_str(node->state));
...@@ -534,6 +530,7 @@ static void dlm_midcomms_receive_buffer(union dlm_packet *p, ...@@ -534,6 +530,7 @@ static void dlm_midcomms_receive_buffer(union dlm_packet *p,
default: default:
WARN_ON(test_bit(DLM_NODE_FLAG_STOP_RX, &node->flags)); WARN_ON(test_bit(DLM_NODE_FLAG_STOP_RX, &node->flags));
dlm_receive_buffer(p, node->nodeid); dlm_receive_buffer(p, node->nodeid);
set_bit(DLM_NODE_ULP_DELIVERED, &node->flags);
break; break;
} }
} else { } else {
...@@ -933,6 +930,49 @@ int dlm_process_incoming_buffer(int nodeid, unsigned char *buf, int len) ...@@ -933,6 +930,49 @@ int dlm_process_incoming_buffer(int nodeid, unsigned char *buf, int len)
return ret; return ret;
} }
void dlm_midcomms_receive_done(int nodeid)
{
struct midcomms_node *node;
int idx;
idx = srcu_read_lock(&nodes_srcu);
node = nodeid2node(nodeid, 0);
if (!node) {
srcu_read_unlock(&nodes_srcu, idx);
return;
}
/* old protocol, we do nothing */
switch (node->version) {
case DLM_VERSION_3_2:
break;
default:
srcu_read_unlock(&nodes_srcu, idx);
return;
}
/* do nothing if we didn't delivered stateful to ulp */
if (!test_and_clear_bit(DLM_NODE_ULP_DELIVERED,
&node->flags)) {
srcu_read_unlock(&nodes_srcu, idx);
return;
}
spin_lock(&node->state_lock);
/* we only ack if state is ESTABLISHED */
switch (node->state) {
case DLM_ESTABLISHED:
spin_unlock(&node->state_lock);
dlm_send_ack(node->nodeid, node->seq_next);
break;
default:
spin_unlock(&node->state_lock);
/* do nothing FIN has it's own ack send */
break;
};
srcu_read_unlock(&nodes_srcu, idx);
}
void dlm_midcomms_unack_msg_resend(int nodeid) void dlm_midcomms_unack_msg_resend(int nodeid)
{ {
struct midcomms_node *node; struct midcomms_node *node;
......
...@@ -89,22 +89,15 @@ static int create_rcom_stateless(struct dlm_ls *ls, int to_nodeid, int type, ...@@ -89,22 +89,15 @@ static int create_rcom_stateless(struct dlm_ls *ls, int to_nodeid, int type,
return 0; return 0;
} }
static void _send_rcom(struct dlm_ls *ls, struct dlm_rcom *rc) static void send_rcom(struct dlm_mhandle *mh, struct dlm_rcom *rc)
{ {
dlm_rcom_out(rc); dlm_rcom_out(rc);
}
static void send_rcom(struct dlm_ls *ls, struct dlm_mhandle *mh,
struct dlm_rcom *rc)
{
_send_rcom(ls, rc);
dlm_midcomms_commit_mhandle(mh); dlm_midcomms_commit_mhandle(mh);
} }
static void send_rcom_stateless(struct dlm_ls *ls, struct dlm_msg *msg, static void send_rcom_stateless(struct dlm_msg *msg, struct dlm_rcom *rc)
struct dlm_rcom *rc)
{ {
_send_rcom(ls, rc); dlm_rcom_out(rc);
dlm_lowcomms_commit_msg(msg); dlm_lowcomms_commit_msg(msg);
dlm_lowcomms_put_msg(msg); dlm_lowcomms_put_msg(msg);
} }
...@@ -204,7 +197,7 @@ int dlm_rcom_status(struct dlm_ls *ls, int nodeid, uint32_t status_flags) ...@@ -204,7 +197,7 @@ int dlm_rcom_status(struct dlm_ls *ls, int nodeid, uint32_t status_flags)
allow_sync_reply(ls, &rc->rc_id); allow_sync_reply(ls, &rc->rc_id);
memset(ls->ls_recover_buf, 0, DLM_MAX_SOCKET_BUFSIZE); memset(ls->ls_recover_buf, 0, DLM_MAX_SOCKET_BUFSIZE);
send_rcom_stateless(ls, msg, rc); send_rcom_stateless(msg, rc);
error = dlm_wait_function(ls, &rcom_response); error = dlm_wait_function(ls, &rcom_response);
disallow_sync_reply(ls); disallow_sync_reply(ls);
...@@ -287,7 +280,7 @@ static void receive_rcom_status(struct dlm_ls *ls, struct dlm_rcom *rc_in) ...@@ -287,7 +280,7 @@ static void receive_rcom_status(struct dlm_ls *ls, struct dlm_rcom *rc_in)
spin_unlock(&ls->ls_recover_lock); spin_unlock(&ls->ls_recover_lock);
do_send: do_send:
send_rcom_stateless(ls, msg, rc); send_rcom_stateless(msg, rc);
} }
static void receive_sync_reply(struct dlm_ls *ls, struct dlm_rcom *rc_in) static void receive_sync_reply(struct dlm_ls *ls, struct dlm_rcom *rc_in)
...@@ -327,7 +320,7 @@ int dlm_rcom_names(struct dlm_ls *ls, int nodeid, char *last_name, int last_len) ...@@ -327,7 +320,7 @@ int dlm_rcom_names(struct dlm_ls *ls, int nodeid, char *last_name, int last_len)
allow_sync_reply(ls, &rc->rc_id); allow_sync_reply(ls, &rc->rc_id);
memset(ls->ls_recover_buf, 0, DLM_MAX_SOCKET_BUFSIZE); memset(ls->ls_recover_buf, 0, DLM_MAX_SOCKET_BUFSIZE);
send_rcom_stateless(ls, msg, rc); send_rcom_stateless(msg, rc);
error = dlm_wait_function(ls, &rcom_response); error = dlm_wait_function(ls, &rcom_response);
disallow_sync_reply(ls); disallow_sync_reply(ls);
...@@ -356,7 +349,7 @@ static void receive_rcom_names(struct dlm_ls *ls, struct dlm_rcom *rc_in) ...@@ -356,7 +349,7 @@ static void receive_rcom_names(struct dlm_ls *ls, struct dlm_rcom *rc_in)
dlm_copy_master_names(ls, rc_in->rc_buf, inlen, rc->rc_buf, outlen, dlm_copy_master_names(ls, rc_in->rc_buf, inlen, rc->rc_buf, outlen,
nodeid); nodeid);
send_rcom_stateless(ls, msg, rc); send_rcom_stateless(msg, rc);
} }
int dlm_send_rcom_lookup(struct dlm_rsb *r, int dir_nodeid) int dlm_send_rcom_lookup(struct dlm_rsb *r, int dir_nodeid)
...@@ -373,7 +366,7 @@ int dlm_send_rcom_lookup(struct dlm_rsb *r, int dir_nodeid) ...@@ -373,7 +366,7 @@ int dlm_send_rcom_lookup(struct dlm_rsb *r, int dir_nodeid)
memcpy(rc->rc_buf, r->res_name, r->res_length); memcpy(rc->rc_buf, r->res_name, r->res_length);
rc->rc_id = (unsigned long) r->res_id; rc->rc_id = (unsigned long) r->res_id;
send_rcom(ls, mh, rc); send_rcom(mh, rc);
out: out:
return error; return error;
} }
...@@ -404,7 +397,7 @@ static void receive_rcom_lookup(struct dlm_ls *ls, struct dlm_rcom *rc_in) ...@@ -404,7 +397,7 @@ static void receive_rcom_lookup(struct dlm_ls *ls, struct dlm_rcom *rc_in)
rc->rc_id = rc_in->rc_id; rc->rc_id = rc_in->rc_id;
rc->rc_seq_reply = rc_in->rc_seq; rc->rc_seq_reply = rc_in->rc_seq;
send_rcom(ls, mh, rc); send_rcom(mh, rc);
} }
static void receive_rcom_lookup_reply(struct dlm_ls *ls, struct dlm_rcom *rc_in) static void receive_rcom_lookup_reply(struct dlm_ls *ls, struct dlm_rcom *rc_in)
...@@ -461,7 +454,7 @@ int dlm_send_rcom_lock(struct dlm_rsb *r, struct dlm_lkb *lkb) ...@@ -461,7 +454,7 @@ int dlm_send_rcom_lock(struct dlm_rsb *r, struct dlm_lkb *lkb)
pack_rcom_lock(r, lkb, rl); pack_rcom_lock(r, lkb, rl);
rc->rc_id = (unsigned long) r; rc->rc_id = (unsigned long) r;
send_rcom(ls, mh, rc); send_rcom(mh, rc);
out: out:
return error; return error;
} }
...@@ -487,7 +480,7 @@ static void receive_rcom_lock(struct dlm_ls *ls, struct dlm_rcom *rc_in) ...@@ -487,7 +480,7 @@ static void receive_rcom_lock(struct dlm_ls *ls, struct dlm_rcom *rc_in)
rc->rc_id = rc_in->rc_id; rc->rc_id = rc_in->rc_id;
rc->rc_seq_reply = rc_in->rc_seq; rc->rc_seq_reply = rc_in->rc_seq;
send_rcom(ls, mh, rc); send_rcom(mh, rc);
} }
/* If the lockspace doesn't exist then still send a status message /* If the lockspace doesn't exist then still send a status message
......
...@@ -125,8 +125,10 @@ static int ls_recover(struct dlm_ls *ls, struct dlm_recover *rv) ...@@ -125,8 +125,10 @@ static int ls_recover(struct dlm_ls *ls, struct dlm_recover *rv)
dlm_recover_waiters_pre(ls); dlm_recover_waiters_pre(ls);
error = dlm_recovery_stopped(ls); error = dlm_recovery_stopped(ls);
if (error) if (error) {
error = -EINTR;
goto fail; goto fail;
}
if (neg || dlm_no_directory(ls)) { if (neg || dlm_no_directory(ls)) {
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment