Whamcloud - gitweb
LU-6128 lnet: handle lnet_check_routes() errors 45/13445/2
authorAmir Shehata <amir.shehata@intel.com>
Fri, 16 Jan 2015 20:42:55 +0000 (12:42 -0800)
committerOleg Drokin <oleg.drokin@intel.com>
Fri, 23 Jan 2015 01:53:34 +0000 (01:53 +0000)
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 <amir.shehata@intel.com>
Change-Id: I9b0cc105f97e7ddb0e4549626606c91118ca3ff5
Reviewed-on: http://review.whamcloud.com/13445
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lnet/lnet/api-ni.c

index fefeb69..3ec8962 100644 (file)
@@ -2155,8 +2155,14 @@ LNetCtl(unsigned int cmd, void *arg)
                                    config->cfg_nid,
                                    config->cfg_config_u.cfg_route.
                                        rtr_priority);
                                    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);
                LNET_MUTEX_UNLOCK(&the_lnet.ln_api_mutex);
-               return (rc != 0) ? rc : lnet_check_routes();
+               return rc;
 
        case IOC_LIBCFS_DEL_ROUTE:
                config = arg;
 
        case IOC_LIBCFS_DEL_ROUTE:
                config = arg;