Return -EEXIST and not -EINVAL when trying to add a
network interface which is not unique.
Some minor cleanup in api-ni.c
Signed-off-by: Amir Shehata <amir.shehata@intel.com>
Change-Id: Ic74a768c0e7688ba0e35740e2ca2ac9ae4f999ea
Reviewed-on: http://review.whamcloud.com/13056
Tested-by: Jenkins
Reviewed-by: Isaac Huang <he.huang@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lnet_startup_lndni(struct lnet_ni *ni, __s32 peer_timeout,
__s32 peer_cr, __s32 peer_buf_cr, __s32 credits)
{
lnet_startup_lndni(struct lnet_ni *ni, __s32 peer_timeout,
__s32 peer_cr, __s32 peer_buf_cr, __s32 credits)
{
int lnd_type;
lnd_t *lnd;
struct lnet_tx_queue *tq;
int lnd_type;
lnd_t *lnd;
struct lnet_tx_queue *tq;
/* Make sure this new NI is unique. */
lnet_net_lock(LNET_LOCK_EX);
/* Make sure this new NI is unique. */
lnet_net_lock(LNET_LOCK_EX);
- if (!lnet_net_unique(LNET_NIDNET(ni->ni_nid), &the_lnet.ln_nis)) {
+ rc = lnet_net_unique(LNET_NIDNET(ni->ni_nid), &the_lnet.ln_nis);
+ lnet_net_unlock(LNET_LOCK_EX);
+
+ if (!rc) {
- lnet_net_unlock(LNET_LOCK_EX);
lnet_ni_free(ni);
return 0;
}
lnet_ni_free(ni);
return 0;
}
- lnet_net_unlock(LNET_LOCK_EX);
CERROR("Net %s is not unique\n",
libcfs_net2str(LNET_NIDNET(ni->ni_nid)));
CERROR("Net %s is not unique\n",
libcfs_net2str(LNET_NIDNET(ni->ni_nid)));
- lnet_net_unlock(LNET_LOCK_EX);
LNET_MUTEX_LOCK(&the_lnet.ln_lnd_mutex);
lnd = lnet_find_lnd_by_type(lnd_type);
LNET_MUTEX_LOCK(&the_lnet.ln_lnd_mutex);
lnd = lnet_find_lnd_by_type(lnd_type);
#ifdef __KERNEL__
if (lnd == NULL) {
LNET_MUTEX_UNLOCK(&the_lnet.ln_lnd_mutex);
#ifdef __KERNEL__
if (lnd == NULL) {
LNET_MUTEX_UNLOCK(&the_lnet.ln_lnd_mutex);
- rc = request_module("%s",
- libcfs_lnd2modname(lnd_type));
+ rc = request_module("%s", libcfs_lnd2modname(lnd_type));
LNET_MUTEX_LOCK(&the_lnet.ln_lnd_mutex);
lnd = lnet_find_lnd_by_type(lnd_type);
LNET_MUTEX_LOCK(&the_lnet.ln_lnd_mutex);
lnd = lnet_find_lnd_by_type(lnd_type);
"compiled with kernel module "
"loading support.");
#endif
"compiled with kernel module "
"loading support.");
#endif
if (ni->ni_peertxcredits == 0 || ni->ni_maxtxcredits == 0) {
LCONSOLE_ERROR_MSG(0x107, "LNI %s has no %scredits\n",
libcfs_lnd2str(lnd->lnd_type),
if (ni->ni_peertxcredits == 0 || ni->ni_maxtxcredits == 0) {
LCONSOLE_ERROR_MSG(0x107, "LNI %s has no %scredits\n",
libcfs_lnd2str(lnd->lnd_type),
- ni->ni_peertxcredits == 0 ?
+ ni->ni_peertxcredits == 0 ?
"" : "per-peer ");
/* shutdown the NI since if we get here then it must've already
* been started
"" : "per-peer ");
/* shutdown the NI since if we get here then it must've already
* been started
return 0;
failed0:
lnet_ni_free(ni);
return 0;
failed0:
lnet_ni_free(ni);
LNetNIInit(lnet_pid_t requested_pid)
{
int im_a_router = 0;
LNetNIInit(lnet_pid_t requested_pid)
{
int im_a_router = 0;
int ni_count;
lnet_ping_info_t *pinfo;
lnet_handle_md_t md_handle;
int ni_count;
lnet_ping_info_t *pinfo;
lnet_handle_md_t md_handle;
- lnet_ping_md_unlink(pinfo, &md_handle);
- lnet_ping_info_free(pinfo);
- rc2 = LNetEQFree(the_lnet.ln_ping_target_eq);
- LASSERT(rc2 == 0);
+ lnet_ping_target_fini();
failed3:
the_lnet.ln_refcount = 0;
lnet_acceptor_stop();
failed3:
the_lnet.ln_refcount = 0;
lnet_acceptor_stop();