struct lnet_eq *
LNetEQAlloc(lnet_eq_handler_t handler);
-int LNetEQFree(struct lnet_eq *eventq_in);
+void LNetEQFree(struct lnet_eq *eventq_in);
/** @} lnet_eq */
struct lnet_eq {
lnet_eq_handler_t eq_callback;
- int **eq_refs; /* percpt refcount for EQ */
};
struct lnet_me {
static int
lnet_unprepare (void)
{
- int rc;
-
/* NB no LNET_LOCK since this is the last reference. All LND instances
* have shut down already, so it is safe to unlink and free all
* descriptors, even those that appear committed to a network op (eg MD
}
if (the_lnet.ln_mt_eq) {
- rc = LNetEQFree(the_lnet.ln_mt_eq);
+ LNetEQFree(the_lnet.ln_mt_eq);
the_lnet.ln_mt_eq = NULL;
- LASSERT(rc == 0);
}
lnet_portals_destroy();
};
struct lnet_me *me;
struct lnet_md md = { NULL };
- int rc, rc2;
+ int rc;
if (set_eq) {
the_lnet.ln_ping_target_eq =
lnet_ping_buffer_decref(*ppbuf);
*ppbuf = NULL;
fail_free_eq:
- if (set_eq) {
- rc2 = LNetEQFree(the_lnet.ln_ping_target_eq);
- LASSERT(rc2 == 0);
- }
+ if (set_eq)
+ LNetEQFree(the_lnet.ln_ping_target_eq);
+
return rc;
}
static void
lnet_ping_target_fini(void)
{
- int rc;
-
lnet_ping_md_unlink(the_lnet.ln_ping_target,
&the_lnet.ln_ping_target_md);
- rc = LNetEQFree(the_lnet.ln_ping_target_eq);
- LASSERT(rc == 0);
+ LNetEQFree(the_lnet.ln_ping_target_eq);
lnet_ping_target_destroy();
}
rc = pbuf->pb_info.pi_nnis;
fail_free_eq:
- rc2 = LNetEQFree(eq);
- if (rc2 != 0)
- CERROR("rc2 %d\n", rc2);
- LASSERT(rc2 == 0);
+ LNetEQFree(eq);
fail_ping_buffer_decref:
lnet_ping_buffer_decref(pbuf);
eq->eq_callback = callback;
- eq->eq_refs = cfs_percpt_alloc(lnet_cpt_table(),
- sizeof(*eq->eq_refs[0]));
- if (eq->eq_refs == NULL)
- goto failed;
-
return eq;
-
-failed:
- if (eq->eq_refs != NULL)
- cfs_percpt_free(eq->eq_refs);
-
- lnet_eq_free(eq);
- return ERR_PTR(-ENOMEM);
}
EXPORT_SYMBOL(LNetEQAlloc);
*
* \param eq The event queue to be released.
*
- * \retval 0 If the EQ is not in use and freed.
- * \retval -EBUSY If the EQ is still in use by some MDs.
*/
-int
+void
LNetEQFree(struct lnet_eq *eq)
{
- int **refs = NULL;
- int *ref;
- int rc = 0;
- int i;
-
- lnet_res_lock(LNET_LOCK_EX);
- /* NB: hold lnet_eq_wait_lock for EQ link/unlink, so we can do
- * both EQ lookup and poll event with only lnet_eq_wait_lock */
- lnet_eq_wait_lock();
-
- cfs_percpt_for_each(ref, i, eq->eq_refs) {
- LASSERT(*ref >= 0);
- if (*ref == 0)
- continue;
-
- CDEBUG(D_NET, "Event equeue (%d: %d) busy on destroy.\n",
- i, *ref);
- rc = -EBUSY;
- goto out;
- }
-
- /* stash for free after lock dropped */
- refs = eq->eq_refs;
-
lnet_eq_free(eq);
- out:
- lnet_eq_wait_unlock();
- lnet_res_unlock(LNET_LOCK_EX);
-
- if (refs != NULL)
- cfs_percpt_free(refs);
-
- return rc;
}
EXPORT_SYMBOL(LNetEQFree);
CDEBUG(D_NET, "Unlinking md %p\n", md);
- if (md->md_eq != NULL) {
- int cpt = lnet_cpt_of_cookie(md->md_lh.lh_cookie);
-
- LASSERT(*md->md_eq->eq_refs[cpt] > 0);
- (*md->md_eq->eq_refs[cpt])--;
- }
-
LASSERT(!list_empty(&md->md_list));
list_del_init(&md->md_list);
lnet_md_free(md);
* maybe there we shouldn't even allow LNET_EQ_NONE!)
* LASSERT (eq == NULL);
*/
- if (eq) {
+ if (eq)
md->md_eq = eq;
- (*md->md_eq->eq_refs[cpt])++;
- }
lnet_res_lh_initialize(container, &md->md_lh);
rc = LNetClearLazyPortal(SRPC_FRAMEWORK_REQUEST_PORTAL);
rc = LNetClearLazyPortal(SRPC_REQUEST_PORTAL);
LASSERT(rc == 0);
- rc = LNetEQFree(srpc_data.rpc_lnet_eq);
- LASSERT(rc == 0); /* the EQ should have no user by now */
+ LNetEQFree(srpc_data.rpc_lnet_eq);
/* fallthrough */
case SRPC_STATE_NI_INIT: