]> git.baikalelectronics.ru Git - kernel.git/commitdiff
fs: dlm: add midcomms init/start functions
authorAlexander Aring <aahringo@redhat.com>
Thu, 17 Nov 2022 22:11:46 +0000 (17:11 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Mar 2023 07:50:18 +0000 (08:50 +0100)
[ Upstream commit 721b8349d0534ccbdef269b55419f3d7ef97e9b6 ]

This patch introduces leftovers of init, start, stop and exit
functionality. The dlm application layer should always call the midcomms
layer which getting aware of such event and redirect it to the lowcomms
layer. Some functionality which is currently handled inside the start
functionality of midcomms and lowcomms should be handled in the init
functionality as it only need to be initialized once when dlm is loaded.

Signed-off-by: Alexander Aring <aahringo@redhat.com>
Signed-off-by: David Teigland <teigland@redhat.com>
Stable-dep-of: 5282c6801f3b ("fs: dlm: start midcomms before scand")
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/dlm/lockspace.c
fs/dlm/lowcomms.c
fs/dlm/lowcomms.h
fs/dlm/main.c
fs/dlm/midcomms.c
fs/dlm/midcomms.h

index 04e1b4fe366dc1445e70bbf79442f3b4253a5d17..c3cf2e7996f6cd7a7324742891cac5d2a29fe098 100644 (file)
@@ -17,7 +17,6 @@
 #include "recoverd.h"
 #include "dir.h"
 #include "midcomms.h"
-#include "lowcomms.h"
 #include "config.h"
 #include "memory.h"
 #include "lock.h"
@@ -726,7 +725,7 @@ static int __dlm_new_lockspace(const char *name, const char *cluster,
        if (!ls_count) {
                dlm_scand_stop();
                dlm_midcomms_shutdown();
-               dlm_lowcomms_stop();
+               dlm_midcomms_stop();
        }
  out:
        mutex_unlock(&ls_lock);
@@ -929,7 +928,7 @@ int dlm_release_lockspace(void *lockspace, int force)
        if (!error)
                ls_count--;
        if (!ls_count)
-               dlm_lowcomms_stop();
+               dlm_midcomms_stop();
        mutex_unlock(&ls_lock);
 
        return error;
index 871d4e9f49fb613276504579965f7f22858775c0..6ed09edabea0c4085e37935c90740ea612f3e8ec 100644 (file)
@@ -1982,10 +1982,6 @@ static const struct dlm_proto_ops dlm_sctp_ops = {
 int dlm_lowcomms_start(void)
 {
        int error = -EINVAL;
-       int i;
-
-       for (i = 0; i < CONN_HASH_SIZE; i++)
-               INIT_HLIST_HEAD(&connection_hash[i]);
 
        init_local();
        if (!dlm_local_count) {
@@ -1994,8 +1990,6 @@ int dlm_lowcomms_start(void)
                goto fail;
        }
 
-       INIT_WORK(&listen_con.rwork, process_listen_recv_socket);
-
        error = work_start();
        if (error)
                goto fail_local;
@@ -2034,6 +2028,16 @@ fail:
        return error;
 }
 
+void dlm_lowcomms_init(void)
+{
+       int i;
+
+       for (i = 0; i < CONN_HASH_SIZE; i++)
+               INIT_HLIST_HEAD(&connection_hash[i]);
+
+       INIT_WORK(&listen_con.rwork, process_listen_recv_socket);
+}
+
 void dlm_lowcomms_exit(void)
 {
        struct dlm_node_addr *na, *safe;
index 29369feea9916846ced5a8c01ccfb462773ffb8a..bbce7a18416dc3cf9b769424cf52f0fb08a1e968 100644 (file)
@@ -35,6 +35,7 @@ extern int dlm_allow_conn;
 int dlm_lowcomms_start(void);
 void dlm_lowcomms_shutdown(void);
 void dlm_lowcomms_stop(void);
+void dlm_lowcomms_init(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,
index 1c5be4b70ac1be667e4631dab6891b63cd71459e..a77338be32371447c658bef2cde8582da02d595d 100644 (file)
@@ -17,7 +17,7 @@
 #include "user.h"
 #include "memory.h"
 #include "config.h"
-#include "lowcomms.h"
+#include "midcomms.h"
 
 #define CREATE_TRACE_POINTS
 #include <trace/events/dlm.h>
@@ -30,6 +30,8 @@ static int __init init_dlm(void)
        if (error)
                goto out;
 
+       dlm_midcomms_init();
+
        error = dlm_lockspace_init();
        if (error)
                goto out_mem;
@@ -66,6 +68,7 @@ static int __init init_dlm(void)
  out_lockspace:
        dlm_lockspace_exit();
  out_mem:
+       dlm_midcomms_exit();
        dlm_memory_exit();
  out:
        return error;
@@ -79,7 +82,7 @@ static void __exit exit_dlm(void)
        dlm_config_exit();
        dlm_memory_exit();
        dlm_lockspace_exit();
-       dlm_lowcomms_exit();
+       dlm_midcomms_exit();
        dlm_unregister_debugfs();
 }
 
index 546c52c46b1c94053a38ac3b320ae7023d6fbca7..095f2005fb62144c224f3ba200dcd1cf0aafe322 100644 (file)
@@ -1160,13 +1160,28 @@ void dlm_midcomms_commit_mhandle(struct dlm_mhandle *mh)
 #endif
 
 int dlm_midcomms_start(void)
+{
+       return dlm_lowcomms_start();
+}
+
+void dlm_midcomms_stop(void)
+{
+       dlm_lowcomms_stop();
+}
+
+void dlm_midcomms_init(void)
 {
        int i;
 
        for (i = 0; i < CONN_HASH_SIZE; i++)
                INIT_HLIST_HEAD(&node_hash[i]);
 
-       return dlm_lowcomms_start();
+       dlm_lowcomms_init();
+}
+
+void dlm_midcomms_exit(void)
+{
+       dlm_lowcomms_exit();
 }
 
 static void dlm_act_fin_ack_rcv(struct midcomms_node *node)
index 82bcd96619228dca94dbbd1659975d620955b884..f61fce622e93d6c7cbf53f7d11be0b686262ab63 100644 (file)
@@ -20,6 +20,9 @@ struct dlm_mhandle *dlm_midcomms_get_mhandle(int nodeid, int len,
 void dlm_midcomms_commit_mhandle(struct dlm_mhandle *mh);
 int dlm_midcomms_close(int nodeid);
 int dlm_midcomms_start(void);
+void dlm_midcomms_stop(void);
+void dlm_midcomms_init(void);
+void dlm_midcomms_exit(void);
 void dlm_midcomms_shutdown(void);
 void dlm_midcomms_add_member(int nodeid);
 void dlm_midcomms_remove_member(int nodeid);