@@ -1145,10 +1145,11 @@ struct lnet {
*/
bool ln_nis_from_mod_params;
- /* waitq for the monitor thread. The monitor thread takes care of
+ /*
+ * completion for the monitor thread. The monitor thread takes care of
* checking routes, timedout messages and resending messages.
*/
- wait_queue_head_t ln_mt_waitq;
+ struct completion ln_mt_wait_complete;
/* per-cpt resend queues */
struct list_head **ln_mt_resendqs;
@@ -486,7 +486,7 @@ static int lnet_discover(struct lnet_process_id id, u32 force,
spin_lock_init(&the_lnet.ln_eq_wait_lock);
spin_lock_init(&the_lnet.ln_msg_resend_lock);
init_waitqueue_head(&the_lnet.ln_eq_waitq);
- init_waitqueue_head(&the_lnet.ln_mt_waitq);
+ init_completion(&the_lnet.ln_mt_wait_complete);
mutex_init(&the_lnet.ln_lnd_mutex);
}
@@ -3276,8 +3276,12 @@ struct lnet_mt_event_info {
min((unsigned int)alive_router_check_interval /
lnet_current_net_count,
lnet_transaction_timeout / 2));
- wait_event_interruptible_timeout(the_lnet.ln_mt_waitq,
- false, HZ * interval);
+ wait_for_completion_interruptible_timeout(&the_lnet.ln_mt_wait_complete,
+ interval * HZ);
+ /* Must re-init the completion before testing anything,
+ * including ln_mt_state.
+ */
+ reinit_completion(&the_lnet.ln_mt_wait_complete);
}
/* Shutting down */
@@ -3539,7 +3543,7 @@ void lnet_monitor_thr_stop(void)
lnet_net_unlock(LNET_LOCK_EX);
/* tell the monitor thread that we're shutting down */
- wake_up(&the_lnet.ln_mt_waitq);
+ complete(&the_lnet.ln_mt_wait_complete);
/* block until monitor thread signals that it's done */
wait_for_completion(&the_lnet.ln_mt_signal);
@@ -640,7 +640,7 @@
list_add_tail(&msg->msg_list, the_lnet.ln_mt_resendqs[msg->msg_tx_cpt]);
- wake_up(&the_lnet.ln_mt_waitq);
+ complete(&the_lnet.ln_mt_wait_complete);
}
int
@@ -674,7 +674,7 @@ static void lnet_shuffle_seed(void)
kfree(rnet);
/* kick start the monitor thread to handle the added route */
- wake_up(&the_lnet.ln_mt_waitq);
+ complete(&the_lnet.ln_mt_wait_complete);
return rc;
}
@@ -1419,7 +1419,7 @@ bool lnet_router_checker_active(void)
lnet_net_lock(LNET_LOCK_EX);
the_lnet.ln_routing = 1;
lnet_net_unlock(LNET_LOCK_EX);
- wake_up(&the_lnet.ln_mt_waitq);
+ complete(&the_lnet.ln_mt_wait_complete);
return 0;
failed: