if (rc != 0)
return rc;
- while (lnet_acceptor_state.pta_shutdown == 0) {
+ while (!lnet_acceptor_state.pta_shutdown) {
rc = libcfs_sock_accept(&newsock, lnet_acceptor_state.pta_sock);
if (rc != 0) {
mutex_down(&lnet_acceptor_state.pta_signal); /* wait for acceptor to startup */
- if (lnet_acceptor_state.pta_shutdown == 0) {
+ if (!lnet_acceptor_state.pta_shutdown) {
/* started OK */
LASSERT (lnet_acceptor_state.pta_sock != NULL);
return 0;
}
int
-lnet_get_tunables()
+lnet_acceptor_get_tunables()
{
int rc;
rc = lnet_parse_string_tunable(&accept_type, "LNET_ACCEPT", "secure");
lnet_acceptor(void *arg)
{
char name[16];
- int secure = (int)((unsigned long)arg);
- int rc;
- int newsock;
+ int secure = (int)((unsigned long)arg);
+ int rc;
+ int newsock;
__u32 peer_ip;
int peer_port;
__u32 magic;
if (rc != 0)
return rc;
- while (lnet_acceptor_state.pta_shutdown == 0) {
+ while (!lnet_acceptor_state.pta_shutdown) {
rc = libcfs_sock_accept(&newsock, lnet_acceptor_state.pta_sock,
&peer_ip, &peer_port);
continue;
/* maybe we're waken up with libcfs_sock_abort_accept() */
- if ( lnet_acceptor_state.pta_shutdown ) {
+ if (lnet_acceptor_state.pta_shutdown) {
close(newsock);
break;
}
long secure;
int rc;
+ rc = lnet_acceptor_get_tunables();
+ if (rc != 0)
+ return rc;
+
/* Do nothing if we're liblustre clients */
- if (the_lnet.ln_pid & LNET_PID_USERFLAG)
+ if ((the_lnet.ln_pid & LNET_PID_USERFLAG) != 0)
return 0;
-
- rc = lnet_get_tunables();
- if ( rc !=0 )
- return rc;
-
+
cfs_init_completion(&lnet_acceptor_state.pta_completion);
if (!strcmp(accept_type, "secure")) {
} else if (!strcmp(accept_type, "all")) {
secure = 0;
} else if (!strcmp(accept_type, "none")) {
+ skip_waiting_for_completion = 1;
return 0;
} else {
LCONSOLE_ERROR ("Can't parse 'accept_type=\"%s\"'\n", accept_type);
}
rc = cfs_create_thread(lnet_acceptor, (void *)secure);
- if (rc) {
+ if (rc != 0) {
CERROR("Can't start acceptor thread: %d\n", rc);
cfs_fini_completion(&lnet_acceptor_state.pta_completion);
return rc;
/* wait for acceptor to startup */
cfs_wait_for_completion(&lnet_acceptor_state.pta_completion);
- if (lnet_acceptor_state.pta_shutdown == 0)
+ if (!lnet_acceptor_state.pta_shutdown)
return 0;
cfs_fini_completion(&lnet_acceptor_state.pta_completion);
lnet_acceptor_stop(void)
{
/* Do nothing if we're liblustre clients */
- if (the_lnet.ln_pid & LNET_PID_USERFLAG)
+ if ((the_lnet.ln_pid & LNET_PID_USERFLAG) != 0)
return;
- if ( !skip_waiting_for_completion ) {
+ if (!skip_waiting_for_completion) {
lnet_acceptor_state.pta_shutdown = 1;
libcfs_sock_abort_accept(accept_port);