[Cluster-devel] [PATCHv5 v5.13-rc1 dlm/next 12/15] fs: dlm: add force flush of writequeue function
Alexander Aring
aahringo at redhat.com
Sat May 15 00:35:46 UTC 2021
This patch adds functionality that the user can force flush dlm messages
in lowcomms writequeue in midcomms reset cases to flush all pending
messages of lowcomms functionality.
Signed-off-by: Alexander Aring <aahringo at redhat.com>
---
fs/dlm/lowcomms.c | 27 +++++++++++++++++++++++++++
fs/dlm/lowcomms.h | 1 +
2 files changed, 28 insertions(+)
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 6c59bf4cc514..d9b7dafcf924 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -1703,6 +1703,33 @@ static void clean_one_writequeue(struct connection *con)
spin_unlock(&con->writequeue_lock);
}
+int dlm_lowcomms_flush(int nodeid, bool cancel_rx)
+{
+ struct connection *con;
+ int idx;
+
+ log_print("flush writequeue of node %d", nodeid);
+ idx = srcu_read_lock(&connections_srcu);
+ con = nodeid2con(nodeid, 0);
+ if (con) {
+ cancel_work_sync(&con->swork);
+ if (cancel_rx)
+ cancel_work_sync(&con->rwork);
+
+ clean_one_writequeue(con);
+ if (con->othercon) {
+ cancel_work_sync(&con->othercon->swork);
+ if (cancel_rx)
+ cancel_work_sync(&con->othercon->rwork);
+
+ clean_one_writequeue(con->othercon);
+ }
+ }
+ srcu_read_unlock(&connections_srcu, idx);
+
+ return 0;
+}
+
/* Called from recovery when it knows that a node has
left the cluster */
int dlm_lowcomms_close(int nodeid)
diff --git a/fs/dlm/lowcomms.h b/fs/dlm/lowcomms.h
index 66dc1bb3de7f..8d74bb2e53e1 100644
--- a/fs/dlm/lowcomms.h
+++ b/fs/dlm/lowcomms.h
@@ -41,6 +41,7 @@ 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);
+int dlm_lowcomms_flush(int nodeid, bool cancel_rx);
#endif /* __LOWCOMMS_DOT_H__ */
--
2.26.3
More information about the Cluster-devel
mailing list