From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1945955AbbKTXlM (ORCPT ); Fri, 20 Nov 2015 18:41:12 -0500 Received: from smtp2.ccs.ornl.gov ([160.91.199.39]:57245 "EHLO smtp2.ccs.ornl.gov" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422698AbbKTXgy (ORCPT ); Fri, 20 Nov 2015 18:36:54 -0500 From: James Simmons To: Greg Kroah-Hartman , devel@driverdev.osuosl.org, Oleg Drokin , Andreas Dilger Cc: Linux Kernel Mailing List , lustre-devel@lists.lustre.org, Amir Shehata Subject: [PATCH 29/40] staging: lustre: handle lnet_check_routes() errors Date: Fri, 20 Nov 2015 18:36:05 -0500 Message-Id: <1448062576-23757-30-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1448062576-23757-1-git-send-email-jsimmons@infradead.org> References: <1448062576-23757-1-git-send-email-jsimmons@infradead.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Amir Shehata 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 Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6218 Reviewed-on: http://review.whamcloud.com/13445 Reviewed-by: Liang Zhen Reviewed-by: Doug Oucharek Reviewed-by: Oleg Drokin --- drivers/staging/lustre/lnet/lnet/api-ni.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index ed167c8..b119c6c 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -1910,8 +1910,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); + } mutex_unlock(&the_lnet.ln_api_mutex); - return (rc != 0) ? rc : lnet_check_routes(); + return rc; case IOC_LIBCFS_DEL_ROUTE: config = arg; -- 1.7.1