This patch will add a functionality to flush pending dlm messages from
the receiving workqueue. Upcoming patches will use it to make sure that
nothing can be received e.g. after a node gets removed from the nodes
hash. Receiving messages will occur into a node lookup which might
create an node for the hash again.

Signed-off-by: Alexander Aring <[email protected]>
---
 fs/dlm/lowcomms.c | 9 +++++++++
 fs/dlm/lowcomms.h | 1 +
 2 files changed, 10 insertions(+)

diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 9a3899ad1765..0e4cbabc680f 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -1607,6 +1607,15 @@ static void clean_one_writequeue(struct connection *con)
        spin_unlock_bh(&con->writequeue_lock);
 }
 
+void dlm_lowcomms_rx_flush(int nodeid)
+{
+       struct connection *con;
+
+       con = nodeid2con(nodeid, 0);
+       if (con)
+               flush_work(&con->rwork);
+}
+
 /* 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 8286531f9a9e..c4c789a68cf6 100644
--- a/fs/dlm/lowcomms.h
+++ b/fs/dlm/lowcomms.h
@@ -39,6 +39,7 @@ int dlm_lowcomms_addr(int nodeid, struct sockaddr_storage 
*addr, int len);
 void dlm_lowcomms_put_buffer(void *mh);
 void dlm_lowcomms_get_buffer(void *mh);
 void dlm_lowcomms_resend_buffer(void *mh);
+void dlm_lowcomms_rx_flush(int nodeid);
 
 #endif                         /* __LOWCOMMS_DOT_H__ */
 
-- 
2.26.2

Reply via email to