From b53998fdcc70c2f58bf436c318a0165f0f5ce224 Mon Sep 17 00:00:00 2001 From: Amir Shehata Date: Fri, 16 Jan 2015 12:42:55 -0800 Subject: [PATCH] LU-6128 lnet: handle lnet_check_routes() errors After adding a route, lnet_check_routes() is called to ensure that the route added doesn't invalidate the routing configuration. If lnet_check_routes() fails then the route just added, which caused the current configuration to be invalidated is deleted, and an error is returned to the user Signed-off-by: Amir Shehata Change-Id: I9b0cc105f97e7ddb0e4549626606c91118ca3ff5 Reviewed-on: http://review.whamcloud.com/13445 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Liang Zhen Reviewed-by: Doug Oucharek Reviewed-by: Oleg Drokin --- lnet/lnet/api-ni.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c index fefeb69..3ec8962 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -2155,8 +2155,14 @@ LNetCtl(unsigned int cmd, void *arg) config->cfg_nid, config->cfg_config_u.cfg_route. rtr_priority); + if (rc == 0) { + rc = lnet_check_routes(); + if (rc != 0) + lnet_del_route(config->cfg_net, + config->cfg_nid); + } LNET_MUTEX_UNLOCK(&the_lnet.ln_api_mutex); - return (rc != 0) ? rc : lnet_check_routes(); + return rc; case IOC_LIBCFS_DEL_ROUTE: config = arg; -- 1.8.3.1