Commit 7ee38424 authored by Amir Shehata's avatar Amir Shehata Committed by Greg Kroah-Hartman

staging: lustre: startup lnet acceptor thread dynamically

With DLC it's possible to start up a system with no NIs that require
the acceptor thread, and thus it won't start.  Later on the user
can add an NI that requires the acceptor thread to start, it is
then necessary to start it up.

If the user removes a NI and as a result there are no more
NIs that require the acceptor thread then it should be stopped.
This patch adds logic in the dynamically adding and removing NIs
code to ensure the above logic is implemented.
Signed-off-by: default avatarAmir Shehata <amir.shehata@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6002
Reviewed-on: http://review.whamcloud.com/13010Reviewed-by: default avatarIsaac Huang <he.huang@intel.com>
Reviewed-by: default avatarDoug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: default avatarOleg Drokin <oleg.drokin@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 24af3e16
...@@ -46,7 +46,9 @@ static struct { ...@@ -46,7 +46,9 @@ static struct {
int pta_shutdown; int pta_shutdown;
struct socket *pta_sock; struct socket *pta_sock;
struct completion pta_signal; struct completion pta_signal;
} lnet_acceptor_state; } lnet_acceptor_state = {
.pta_shutdown = 1
};
int int
lnet_acceptor_port(void) lnet_acceptor_port(void)
...@@ -444,6 +446,10 @@ lnet_acceptor_start(void) ...@@ -444,6 +446,10 @@ lnet_acceptor_start(void)
long rc2; long rc2;
long secure; long secure;
/* if acceptor is already running return immediately */
if (!lnet_acceptor_state.pta_shutdown)
return 0;
LASSERT(!lnet_acceptor_state.pta_sock); LASSERT(!lnet_acceptor_state.pta_sock);
rc = lnet_acceptor_get_tunables(); rc = lnet_acceptor_get_tunables();
...@@ -484,7 +490,7 @@ lnet_acceptor_start(void) ...@@ -484,7 +490,7 @@ lnet_acceptor_start(void)
void void
lnet_acceptor_stop(void) lnet_acceptor_stop(void)
{ {
if (!lnet_acceptor_state.pta_sock) /* not running */ if (lnet_acceptor_state.pta_shutdown) /* not running */
return; return;
lnet_acceptor_state.pta_shutdown = 1; lnet_acceptor_state.pta_shutdown = 1;
......
...@@ -1785,6 +1785,16 @@ lnet_dyn_add_ni(lnet_pid_t requested_pid, char *nets, ...@@ -1785,6 +1785,16 @@ lnet_dyn_add_ni(lnet_pid_t requested_pid, char *nets,
if (rc) if (rc)
goto failed1; goto failed1;
if (ni->ni_lnd->lnd_accept) {
rc = lnet_acceptor_start();
if (rc < 0) {
/* shutdown the ni that we just started */
CERROR("Failed to start up acceptor thread\n");
lnet_shutdown_lndni(ni);
goto failed1;
}
}
lnet_ping_target_update(pinfo, md_handle); lnet_ping_target_update(pinfo, md_handle);
mutex_unlock(&the_lnet.ln_api_mutex); mutex_unlock(&the_lnet.ln_api_mutex);
...@@ -1832,6 +1842,10 @@ lnet_dyn_del_ni(__u32 net) ...@@ -1832,6 +1842,10 @@ lnet_dyn_del_ni(__u32 net)
lnet_ni_decref_locked(ni, 0); lnet_ni_decref_locked(ni, 0);
lnet_shutdown_lndni(ni); lnet_shutdown_lndni(ni);
if (!lnet_count_acceptor_nis())
lnet_acceptor_stop();
lnet_ping_target_update(pinfo, md_handle); lnet_ping_target_update(pinfo, md_handle);
goto out; goto out;
failed: failed:
......
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