mutex_init(&the_lnet.ln_lnd_mutex);
}
-static void
-lnet_fini_locks(void)
-{
-}
-
struct kmem_cache *lnet_mes_cachep; /* MEs kmem_cache */
struct kmem_cache *lnet_small_mds_cachep; /* <= LNET_SMALL_MD_SIZE bytes
* MDs kmem_cache */
cfs_percpt_lock_free(the_lnet.ln_net_lock);
the_lnet.ln_net_lock = NULL;
}
-
- lnet_fini_locks();
}
static int
BUILD_BUG_ON((int)sizeof(((struct lnet_ping_info *)0)->pi_ni) != 0);
}
-static struct lnet_lnd *lnet_find_lnd_by_type(__u32 type)
+static const struct lnet_lnd *lnet_find_lnd_by_type(__u32 type)
{
- struct lnet_lnd *lnd;
+ const struct lnet_lnd *lnd;
/* holding lnd mutex */
if (type >= NUM_LNDS)
EXPORT_SYMBOL(lnet_get_lnd_timeout);
void
-lnet_register_lnd(struct lnet_lnd *lnd)
+lnet_register_lnd(const struct lnet_lnd *lnd)
{
mutex_lock(&the_lnet.ln_lnd_mutex);
EXPORT_SYMBOL(lnet_register_lnd);
void
-lnet_unregister_lnd(struct lnet_lnd *lnd)
+lnet_unregister_lnd(const struct lnet_lnd *lnd)
{
mutex_lock(&the_lnet.ln_lnd_mutex);
islo = ni->ni_net->net_lnd->lnd_type == LOLND;
LASSERT(!in_interrupt());
+ /* Holding the mutex makes it safe for lnd_shutdown
+ * to call module_put(). Module unload cannot finish
+ * until lnet_unregister_lnd() completes, and that
+ * requires the mutex.
+ */
+ mutex_lock(&the_lnet.ln_lnd_mutex);
(net->net_lnd->lnd_shutdown)(ni);
+ mutex_unlock(&the_lnet.ln_lnd_mutex);
if (!islo)
CDEBUG(D_LNI, "Removed LNI %s\n",
int rc;
int ni_count = 0;
__u32 lnd_type;
- struct lnet_lnd *lnd;
+ const struct lnet_lnd *lnd;
int peer_timeout =
net->net_tunables.lct_peer_timeout;
int maxtxcredits =
return 0;
case IOC_LIBCFS_TESTPROTOCOMPAT:
- lnet_net_lock(LNET_LOCK_EX);
the_lnet.ln_testprotocompat = data->ioc_flags;
- lnet_net_unlock(LNET_LOCK_EX);
return 0;
case IOC_LIBCFS_LNET_FAULT: