@@ -517,6 +517,7 @@ static void ptlrpc_ni_fini(void)
percpu_ref_kill(&ptlrpc_pending);
wait_for_completion(&ptlrpc_done);
+ lnet_assert_handler_unused(ptlrpc_handler);
LNetNIFini();
}
@@ -126,6 +126,8 @@ int LNetMDBind(const struct lnet_md *md_in,
struct lnet_handle_md *md_handle_out);
int LNetMDUnlink(struct lnet_handle_md md_in);
+
+void lnet_assert_handler_unused(lnet_handler_t handler);
/** @} lnet_md */
/** \defgroup lnet_data Data movement operations
@@ -1231,6 +1231,7 @@ struct list_head **
the_lnet.ln_mt_zombie_rstqs = NULL;
}
+ lnet_assert_handler_unused(the_lnet.ln_mt_handler);
the_lnet.ln_mt_handler = NULL;
lnet_portals_destroy();
@@ -1795,6 +1796,7 @@ struct lnet_ping_buffer *
lnet_ping_md_unlink(the_lnet.ln_ping_target,
&the_lnet.ln_ping_target_md);
+ lnet_assert_handler_unused(the_lnet.ln_ping_target_handler);
lnet_ping_target_destroy();
}
@@ -1969,6 +1971,7 @@ static void lnet_push_target_fini(void)
the_lnet.ln_push_target_nnis = 0;
LNetClearLazyPortal(LNET_RESERVED_PORTAL);
+ lnet_assert_handler_unused(the_lnet.ln_push_target_handler);
the_lnet.ln_push_target_handler = NULL;
}
@@ -262,6 +262,25 @@ int lnet_cpt_of_md(struct lnet_libmd *md, unsigned int offset)
list_add(&md->md_list, &container->rec_active);
}
+void lnet_assert_handler_unused(lnet_handler_t handler)
+{
+ struct lnet_res_container *container;
+ int cpt;
+
+ if (!handler)
+ return;
+
+ cfs_percpt_for_each(container, cpt, the_lnet.ln_md_containers) {
+ struct lnet_libmd *md;
+
+ lnet_res_lock(cpt);
+ list_for_each_entry(md, &container->rec_active, md_list)
+ LASSERT(md->md_handler != handler);
+ lnet_res_unlock(cpt);
+ }
+}
+EXPORT_SYMBOL(lnet_assert_handler_unused);
+
/* must be called with lnet_res_lock held */
void
lnet_md_deconstruct(struct lnet_libmd *lmd, struct lnet_event *ev)
@@ -3473,6 +3473,7 @@ static int lnet_peer_discovery(void *arg)
}
lnet_net_unlock(LNET_LOCK_EX);
+ lnet_assert_handler_unused(the_lnet.ln_dc_handler);
the_lnet.ln_dc_handler = NULL;
the_lnet.ln_dc_state = LNET_DC_STATE_SHUTDOWN;
@@ -1672,6 +1672,7 @@ struct srpc_client_rpc *
rc = LNetClearLazyPortal(SRPC_FRAMEWORK_REQUEST_PORTAL);
rc = LNetClearLazyPortal(SRPC_REQUEST_PORTAL);
LASSERT(!rc);
+ lnet_assert_handler_unused(srpc_data.rpc_lnet_handler);
/* fall through */
case SRPC_STATE_NI_INIT:
LNetNIFini();