From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422822AbbKTXlf (ORCPT ); Fri, 20 Nov 2015 18:41:35 -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 S1422747AbbKTXgx (ORCPT ); Fri, 20 Nov 2015 18:36:53 -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 27/40] staging: lustre: reject invalid net configuration for lnet Date: Fri, 20 Nov 2015 18:36:03 -0500 Message-Id: <1448062576-23757-28-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 Currently if there exists a route that goes over a remote net and then this net is added dynamically as a local net, then traffic stops because the code in lnet_send() determines that the destination nid can be reached from another local_ni, but the src_nid is still stuck on the earlier NI, because the src_nid is stored in the ptlrpc layer and is not updated when a local NI is configured. Signed-off-by: Amir Shehata Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5874 Reviewed-on: http://review.whamcloud.com/12912 Reviewed-by: Isaac Huang Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- drivers/staging/lustre/lnet/lnet/api-ni.c | 18 +++++++++++++++++- 1 files changed, 17 insertions(+), 1 deletions(-) diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c b/drivers/staging/lustre/lnet/lnet/api-ni.c index 7d6e59f..9b00bc1 100644 --- a/drivers/staging/lustre/lnet/lnet/api-ni.c +++ b/drivers/staging/lustre/lnet/lnet/api-ni.c @@ -1747,6 +1747,7 @@ lnet_dyn_add_ni(lnet_pid_t requested_pid, char *nets, lnet_handle_md_t md_handle; struct lnet_ni *ni; struct list_head net_head; + lnet_remotenet_t *rnet; int rc; INIT_LIST_HEAD(&net_head); @@ -1763,12 +1764,27 @@ lnet_dyn_add_ni(lnet_pid_t requested_pid, char *nets, goto failed0; } + ni = list_entry(net_head.next, struct lnet_ni, ni_list); + + lnet_net_lock(LNET_LOCK_EX); + rnet = lnet_find_net_locked(LNET_NIDNET(ni->ni_nid)); + lnet_net_unlock(LNET_LOCK_EX); + /* + * make sure that the net added doesn't invalidate the current + * configuration LNet is keeping + */ + if (rnet) { + CERROR("Adding net %s will invalidate routing configuration\n", + nets); + rc = -EUSERS; + goto failed0; + } + rc = lnet_ping_info_setup(&pinfo, &md_handle, 1 + lnet_get_ni_count(), false); if (rc != 0) goto failed0; - ni = list_entry(net_head.next, struct lnet_ni, ni_list); list_del_init(&ni->ni_list); rc = lnet_startup_lndni(ni, peer_timeout, peer_cr, -- 1.7.1