Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1340031
| From | James Simmons <jsimmons@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 13/24] staging: lustre: return -EEXIST if NI is not unique |
| Date | 2016-02-22 23:40 +0100 |
| Message-ID | <r57j5-4kk-45@gated-at.bofh.it> (permalink) |
| References | <r579o-4ce-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Amir Shehata <amir.shehata@intel.com>
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>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5875
Reviewed-on: http://review.whamcloud.com/13056
Reviewed-by: Isaac Huang <he.huang@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
---
drivers/staging/lustre/lnet/lnet/api-ni.c | 20 +++++++++-----------
1 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c
index 62a9e45..ccd7dcd 100644
--- a/drivers/staging/lustre/lnet/lnet/api-ni.c
+++ b/drivers/staging/lustre/lnet/lnet/api-ni.c
@@ -1219,7 +1219,7 @@ static int
lnet_startup_lndni(struct lnet_ni *ni, __s32 peer_timeout,
__s32 peer_cr, __s32 peer_buf_cr, __s32 credits)
{
- int rc = 0;
+ int rc = -EINVAL;
int lnd_type;
lnd_t *lnd;
struct lnet_tx_queue *tq;
@@ -1237,19 +1237,19 @@ lnet_startup_lndni(struct lnet_ni *ni, __s32 peer_timeout,
/* 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) {
if (lnd_type == LOLND) {
- lnet_net_unlock(LNET_LOCK_EX);
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)));
+ rc = -EEXIST;
goto failed0;
}
- lnet_net_unlock(LNET_LOCK_EX);
mutex_lock(&the_lnet.ln_lnd_mutex);
lnd = lnet_find_lnd_by_type(lnd_type);
@@ -1265,6 +1265,7 @@ lnet_startup_lndni(struct lnet_ni *ni, __s32 peer_timeout,
CERROR("Can't load LND %s, module %s, rc=%d\n",
libcfs_lnd2str(lnd_type),
libcfs_lnd2modname(lnd_type), rc);
+ rc = -EINVAL;
goto failed0;
}
}
@@ -1354,7 +1355,7 @@ lnet_startup_lndni(struct lnet_ni *ni, __s32 peer_timeout,
return 0;
failed0:
lnet_ni_free(ni);
- return -EINVAL;
+ return rc;
}
static int
@@ -1503,7 +1504,7 @@ int
LNetNIInit(lnet_pid_t requested_pid)
{
int im_a_router = 0;
- int rc, rc2;
+ int rc;
int ni_count;
lnet_ping_info_t *pinfo;
lnet_handle_md_t md_handle;
@@ -1592,10 +1593,7 @@ LNetNIInit(lnet_pid_t requested_pid)
return 0;
err_stop_ping:
- lnet_ping_md_unlink(pinfo, &md_handle);
- lnet_ping_info_free(pinfo);
- rc2 = LNetEQFree(the_lnet.ln_ping_target_eq);
- LASSERT(!rc2);
+ lnet_ping_target_fini();
err_acceptor_stop:
the_lnet.ln_refcount = 0;
lnet_acceptor_stop();
--
1.7.1
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 00/24] Second batch of LNet updates James Simmons <jsimmons@infradead.org> - 2016-02-22 23:30 +0100
[PATCH 17/24] staging: lustre: prevent assert on LNet module unload James Simmons <jsimmons@infradead.org> - 2016-02-22 23:40 +0100
[PATCH 24/24] staging: lustre: Remove LASSERTS from router checker James Simmons <jsimmons@infradead.org> - 2016-02-22 23:40 +0100
[PATCH 19/24] staging: lustre: remove unnecessary EXPORT_SYMBOL from lnet layer James Simmons <jsimmons@infradead.org> - 2016-02-22 23:40 +0100
[PATCH 01/24] staging: lustre: Dynamic LNet Configuration (DLC) IOCTL changes James Simmons <jsimmons@infradead.org> - 2016-02-22 23:40 +0100
[PATCH 07/24] staging: lustre: improve LNet clean up code and API James Simmons <jsimmons@infradead.org> - 2016-02-22 23:40 +0100
[PATCH 23/24] staging: lustre: Use lnet_is_route_alive for router aliveness James Simmons <jsimmons@infradead.org> - 2016-02-22 23:40 +0100
[PATCH 22/24] staging: lustre: Allocate the correct number of rtr buffers James Simmons <jsimmons@infradead.org> - 2016-02-22 23:40 +0100
[PATCH 20/24] staging: lustre: avoid race during lnet acceptor thread termination James Simmons <jsimmons@infradead.org> - 2016-02-22 23:40 +0100
[PATCH 11/24] staging: lustre: startup lnet acceptor thread dynamically James Simmons <jsimmons@infradead.org> - 2016-02-22 23:40 +0100
[PATCH 09/24] staging: lustre: make some lnet functions static James Simmons <jsimmons@infradead.org> - 2016-02-22 23:40 +0100
[PATCH 04/24] staging: lustre: DLC user/kernel space glue code James Simmons <jsimmons@infradead.org> - 2016-02-22 23:40 +0100
[PATCH 13/24] staging: lustre: return -EEXIST if NI is not unique James Simmons <jsimmons@infradead.org> - 2016-02-22 23:40 +0100
[PATCH 03/24] staging: lustre: fix crash due to NULL networks string James Simmons <jsimmons@infradead.org> - 2016-02-22 23:40 +0100
[PATCH 21/24] staging: lustre: use sock.h in only acceptor.c James Simmons <jsimmons@infradead.org> - 2016-02-22 23:40 +0100
[PATCH 18/24] staging: lustre: remove messages from lazy portal on NI shutdown James Simmons <jsimmons@infradead.org> - 2016-02-22 23:40 +0100
[PATCH 05/24] staging: lustre: make local functions static for LNet ni James Simmons <jsimmons@infradead.org> - 2016-02-22 23:40 +0100
[PATCH 06/24] staging: lustre: remove LUSTRE_{,SRV_}LNET_PID James Simmons <jsimmons@infradead.org> - 2016-02-22 23:40 +0100
[PATCH 16/24] staging: lustre: assume a kernel build James Simmons <jsimmons@infradead.org> - 2016-02-22 23:40 +0100
[PATCH 10/24] staging: lustre: missed a few cases of using NULL instead of 0 James Simmons <jsimmons@infradead.org> - 2016-02-22 23:40 +0100
[PATCH 14/24] staging: lustre: handle lnet_check_routes() errors James Simmons <jsimmons@infradead.org> - 2016-02-22 23:40 +0100
[PATCH 08/24] staging: lustre: return appropriate errno when adding route James Simmons <jsimmons@infradead.org> - 2016-02-22 23:40 +0100
[PATCH 12/24] staging: lustre: reject invalid net configuration for lnet James Simmons <jsimmons@infradead.org> - 2016-02-22 23:40 +0100
csiph-web