Commit 1037c2a9 authored by Alexander Aring's avatar Alexander Aring Committed by David Teigland

fs: dlm: use listen sock as dlm running indicator

This patch will switch from dlm_allow_conn to check if dlm lowcomms is
running or not to if we actually have a listen socket set or not. The
list socket will be set and unset in lowcomms start and shutdown
functionality. To synchronize with data_ready() callback we will set the
socket callback to NULL while socket lock is held.
Signed-off-by: default avatarAlexander Aring <aahringo@redhat.com>
Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
parent dd070a56
...@@ -183,7 +183,7 @@ static int dlm_check_protocol_and_dlm_running(unsigned int x) ...@@ -183,7 +183,7 @@ static int dlm_check_protocol_and_dlm_running(unsigned int x)
return -EINVAL; return -EINVAL;
} }
if (dlm_allow_conn) if (dlm_lowcomms_is_running())
return -EBUSY; return -EBUSY;
return 0; return 0;
...@@ -194,7 +194,7 @@ static int dlm_check_zero_and_dlm_running(unsigned int x) ...@@ -194,7 +194,7 @@ static int dlm_check_zero_and_dlm_running(unsigned int x)
if (!x) if (!x)
return -EINVAL; return -EINVAL;
if (dlm_allow_conn) if (dlm_lowcomms_is_running())
return -EBUSY; return -EBUSY;
return 0; return 0;
......
...@@ -176,7 +176,6 @@ static DEFINE_SPINLOCK(dlm_node_addrs_spin); ...@@ -176,7 +176,6 @@ static DEFINE_SPINLOCK(dlm_node_addrs_spin);
static struct listen_connection listen_con; static struct listen_connection listen_con;
static struct sockaddr_storage *dlm_local_addr[DLM_MAX_ADDR_COUNT]; static struct sockaddr_storage *dlm_local_addr[DLM_MAX_ADDR_COUNT];
static int dlm_local_count; static int dlm_local_count;
int dlm_allow_conn;
/* Work queues */ /* Work queues */
static struct workqueue_struct *recv_workqueue; static struct workqueue_struct *recv_workqueue;
...@@ -191,6 +190,11 @@ static const struct dlm_proto_ops *dlm_proto_ops; ...@@ -191,6 +190,11 @@ static const struct dlm_proto_ops *dlm_proto_ops;
static void process_recv_sockets(struct work_struct *work); static void process_recv_sockets(struct work_struct *work);
static void process_send_sockets(struct work_struct *work); static void process_send_sockets(struct work_struct *work);
bool dlm_lowcomms_is_running(void)
{
return !!listen_con.sock;
}
static void writequeue_entry_ctor(void *data) static void writequeue_entry_ctor(void *data)
{ {
struct writequeue_entry *entry = data; struct writequeue_entry *entry = data;
...@@ -511,9 +515,6 @@ static void lowcomms_data_ready(struct sock *sk) ...@@ -511,9 +515,6 @@ static void lowcomms_data_ready(struct sock *sk)
static void lowcomms_listen_data_ready(struct sock *sk) static void lowcomms_listen_data_ready(struct sock *sk)
{ {
if (!dlm_allow_conn)
return;
queue_work(recv_workqueue, &listen_con.rwork); queue_work(recv_workqueue, &listen_con.rwork);
} }
...@@ -1689,10 +1690,7 @@ void dlm_lowcomms_shutdown(void) ...@@ -1689,10 +1690,7 @@ void dlm_lowcomms_shutdown(void)
{ {
int idx; int idx;
/* Set all the flags to prevent any restore_callbacks(listen_con.sock);
* socket activity.
*/
dlm_allow_conn = 0;
if (recv_workqueue) if (recv_workqueue)
flush_workqueue(recv_workqueue); flush_workqueue(recv_workqueue);
...@@ -1995,8 +1993,6 @@ int dlm_lowcomms_start(void) ...@@ -1995,8 +1993,6 @@ int dlm_lowcomms_start(void)
if (error) if (error)
goto fail_local; goto fail_local;
dlm_allow_conn = 1;
/* Start listening */ /* Start listening */
switch (dlm_config.ci_protocol) { switch (dlm_config.ci_protocol) {
case DLM_PROTO_TCP: case DLM_PROTO_TCP:
...@@ -2021,7 +2017,6 @@ int dlm_lowcomms_start(void) ...@@ -2021,7 +2017,6 @@ int dlm_lowcomms_start(void)
fail_listen: fail_listen:
dlm_proto_ops = NULL; dlm_proto_ops = NULL;
fail_proto_ops: fail_proto_ops:
dlm_allow_conn = 0;
work_stop(); work_stop();
fail_local: fail_local:
deinit_local(); deinit_local();
......
...@@ -29,8 +29,8 @@ static inline int nodeid_hash(int nodeid) ...@@ -29,8 +29,8 @@ static inline int nodeid_hash(int nodeid)
return nodeid & (CONN_HASH_SIZE-1); return nodeid & (CONN_HASH_SIZE-1);
} }
/* switch to check if dlm is running */ /* check if dlm is running */
extern int dlm_allow_conn; bool dlm_lowcomms_is_running(void);
int dlm_lowcomms_start(void); int dlm_lowcomms_start(void);
void dlm_lowcomms_shutdown(void); void dlm_lowcomms_shutdown(void);
......
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