From: James Simmons <jsimmons@infradead.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devel@driverdev.osuosl.org,
Andreas Dilger <andreas.dilger@intel.com>,
Oleg Drokin <oleg.drokin@intel.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Lustre Development List <lustre-devel@lists.lustre.org>,
Amir Shehata <amir.shehata@intel.com>
Subject: [PATCH 08/24] staging: lustre: return appropriate errno when adding route
Date: Mon, 22 Feb 2016 17:29:09 -0500 [thread overview]
Message-ID: <1456180165-1105-9-git-send-email-jsimmons@infradead.org> (raw)
In-Reply-To: <1456180165-1105-1-git-send-email-jsimmons@infradead.org>
From: Amir Shehata <amir.shehata@intel.com>
When adding route it ignored specific scenarios, namely:
1. route already exists
2. route is on a local net
3. route is unreacheable
This patch returns the appropriate return codes from the lower level
function lnet_add_route(), and then ignores the above case from the
calling function, lnet_parse_route(). This is needed so we don't
halt processing routes in the module parameters.
However, we can now add routes dynamically, and it should be returned
to the user whether adding the requested route succeeded or failed.
In userspace it is determined whether to continue adding routes or to
halt processing. Currently "lnetctl import < config" continues
adding the rest of the configuration and reports at the end which
operations passed and which ones failed.
Signed-off-by: Amir Shehata <amir.shehata@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6045
Reviewed-on: http://review.whamcloud.com/13116
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: Isaac Huang <he.huang@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
---
drivers/staging/lustre/lnet/lnet/config.c | 2 +-
drivers/staging/lustre/lnet/lnet/router.c | 11 +++++++----
2 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/lustre/lnet/lnet/config.c b/drivers/staging/lustre/lnet/lnet/config.c
index c04a0ef..8c80625 100644
--- a/drivers/staging/lustre/lnet/lnet/config.c
+++ b/drivers/staging/lustre/lnet/lnet/config.c
@@ -769,7 +769,7 @@ lnet_parse_route(char *str, int *im_a_router)
}
rc = lnet_add_route(net, hops, nid, priority);
- if (rc) {
+ if (rc && rc != -EEXIST && rc != -EHOSTUNREACH) {
CERROR("Can't create route to %s via %s\n",
libcfs_net2str(net),
libcfs_nid2str(nid));
diff --git a/drivers/staging/lustre/lnet/lnet/router.c b/drivers/staging/lustre/lnet/lnet/router.c
index d748931..511e446 100644
--- a/drivers/staging/lustre/lnet/lnet/router.c
+++ b/drivers/staging/lustre/lnet/lnet/router.c
@@ -317,7 +317,7 @@ lnet_add_route(__u32 net, unsigned int hops, lnet_nid_t gateway,
return -EINVAL;
if (lnet_islocalnet(net)) /* it's a local network */
- return 0; /* ignore the route entry */
+ return -EEXIST;
/* Assume net, route, all new */
LIBCFS_ALLOC(route, sizeof(*route));
@@ -348,7 +348,7 @@ lnet_add_route(__u32 net, unsigned int hops, lnet_nid_t gateway,
LIBCFS_FREE(rnet, sizeof(*rnet));
if (rc == -EHOSTUNREACH) /* gateway is not on a local net */
- return 0; /* ignore the route entry */
+ return rc; /* ignore the route entry */
CERROR("Error %d creating route %s %d %s\n", rc,
libcfs_net2str(net), hops,
libcfs_nid2str(gateway));
@@ -395,14 +395,17 @@ lnet_add_route(__u32 net, unsigned int hops, lnet_nid_t gateway,
/* -1 for notify or !add_route */
lnet_peer_decref_locked(route->lr_gateway);
lnet_net_unlock(LNET_LOCK_EX);
+ rc = 0;
- if (!add_route)
+ if (!add_route) {
+ rc = -EEXIST;
LIBCFS_FREE(route, sizeof(*route));
+ }
if (rnet != rnet2)
LIBCFS_FREE(rnet, sizeof(*rnet));
- return 0;
+ return rc;
}
int
--
1.7.1
next prev parent reply other threads:[~2016-02-22 22:35 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-22 22:29 [PATCH 00/24] Second batch of LNet updates James Simmons
2016-02-22 22:29 ` [PATCH 01/24] staging: lustre: Dynamic LNet Configuration (DLC) IOCTL changes James Simmons
2016-02-22 22:29 ` [PATCH 02/24] staging: lustre: Dynamic LNet Configuration (DLC) show command James Simmons
2016-02-22 22:29 ` [PATCH 03/24] staging: lustre: fix crash due to NULL networks string James Simmons
2016-02-22 22:29 ` [PATCH 04/24] staging: lustre: DLC user/kernel space glue code James Simmons
2016-02-22 22:29 ` [PATCH 05/24] staging: lustre: make local functions static for LNet ni James Simmons
2016-02-22 22:29 ` [PATCH 06/24] staging: lustre: remove LUSTRE_{,SRV_}LNET_PID James Simmons
2016-02-22 22:29 ` [PATCH 07/24] staging: lustre: improve LNet clean up code and API James Simmons
2016-02-22 22:29 ` James Simmons [this message]
2016-02-22 22:29 ` [PATCH 09/24] staging: lustre: make some lnet functions static James Simmons
2016-02-22 22:29 ` [PATCH 10/24] staging: lustre: missed a few cases of using NULL instead of 0 James Simmons
2016-02-22 22:29 ` [PATCH 11/24] staging: lustre: startup lnet acceptor thread dynamically James Simmons
2016-02-22 22:29 ` [PATCH 12/24] staging: lustre: reject invalid net configuration for lnet James Simmons
2016-02-22 22:29 ` [PATCH 13/24] staging: lustre: return -EEXIST if NI is not unique James Simmons
2016-02-22 22:29 ` [PATCH 14/24] staging: lustre: handle lnet_check_routes() errors James Simmons
2016-02-22 22:29 ` [PATCH 15/24] staging: lustre: improvement to router checker James Simmons
2016-02-22 22:29 ` [PATCH 16/24] staging: lustre: assume a kernel build James Simmons
2016-02-22 22:29 ` [PATCH 17/24] staging: lustre: prevent assert on LNet module unload James Simmons
2016-02-22 22:29 ` [PATCH 18/24] staging: lustre: remove messages from lazy portal on NI shutdown James Simmons
2016-02-22 22:29 ` [PATCH 19/24] staging: lustre: remove unnecessary EXPORT_SYMBOL from lnet layer James Simmons
2016-02-22 22:29 ` [PATCH 20/24] staging: lustre: avoid race during lnet acceptor thread termination James Simmons
2016-02-22 22:29 ` [PATCH 21/24] staging: lustre: use sock.h in only acceptor.c James Simmons
2016-02-22 22:29 ` [PATCH 22/24] staging: lustre: Allocate the correct number of rtr buffers James Simmons
2016-02-22 22:29 ` [PATCH 23/24] staging: lustre: Use lnet_is_route_alive for router aliveness James Simmons
2016-02-22 22:29 ` [PATCH 24/24] staging: lustre: Remove LASSERTS from router checker James Simmons
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1456180165-1105-9-git-send-email-jsimmons@infradead.org \
--to=jsimmons@infradead.org \
--cc=amir.shehata@intel.com \
--cc=andreas.dilger@intel.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lustre-devel@lists.lustre.org \
--cc=oleg.drokin@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®