From patchwork Thu Jun 26 11:47:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 4427371 X-Patchwork-Delegate: hal@mellanox.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DCA9A9F333 for ; Thu, 26 Jun 2014 11:47:57 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F39BD20381 for ; Thu, 26 Jun 2014 11:47:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 60B8B20379 for ; Thu, 26 Jun 2014 11:47:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932193AbaFZLrw (ORCPT ); Thu, 26 Jun 2014 07:47:52 -0400 Received: from mail-wg0-f48.google.com ([74.125.82.48]:59655 "EHLO mail-wg0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932176AbaFZLrv (ORCPT ); Thu, 26 Jun 2014 07:47:51 -0400 Received: by mail-wg0-f48.google.com with SMTP id n12so3420733wgh.7 for ; Thu, 26 Jun 2014 04:47:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :cc:subject:content-type:content-transfer-encoding; bh=VRcSQLPKjILGhpdExjS9DiiN1MpzfiokpZLHaJQ4kus=; b=iXiUH/mnBelWwjFOt5Gl0DFpAfetgcA+jgyLwwCgGujDouc2CNrmc3vrnhPhHh9IK3 deRF4kN2d46To4muc+sQoE5N+NDgq00QC85/8ri4DOKN817CtxXZP7F7Nr8u33OQSt/G trvOY3+d0dXuvYxI7hls++tM95Vp3Ih2vdRrygofot9Xqc7OmtUSuH8Kes10DjBLcYix E7q34s/ZRzRIDrPCxrgvG09ZvTHyhKxWb9bIgtImY+HwoEkZX0KFZ0KHHAtw2UGvhkpL tkHTCqDPyYIjEDKyiRHZA93MJVI+7xJ+YV9p2KudVgin/SNR2yu1wcaU1TZ1x1dnktn9 /H7w== X-Gm-Message-State: ALoCoQm7Gg1gVcqCrM8FDN/NAS6Bnn0Bbyq2PGdIA+MirmoTTPl8zq6mNzJsdBCVwlZx5Sx+H9sm X-Received: by 10.194.5.103 with SMTP id r7mr17332728wjr.41.1403783269700; Thu, 26 Jun 2014 04:47:49 -0700 (PDT) Received: from [192.168.1.102] (c-98-229-118-119.hsd1.ma.comcast.net. [98.229.118.119]) by mx.google.com with ESMTPSA id o3sm23624691wix.15.2014.06.26.04.47.48 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 26 Jun 2014 04:47:48 -0700 (PDT) Message-ID: <53AC0862.604@dev.mellanox.co.il> Date: Thu, 26 Jun 2014 07:47:46 -0400 From: Hal Rosenstock User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:9.0) Gecko/20111222 Thunderbird/9.0.1 MIME-Version: 1.0 To: "linux-rdma (linux-rdma@vger.kernel.org)" CC: Vladimir Koushnir Subject: [PATCH opensm] osm_state_mgr.c: Improve error flow with wrong LIDs Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Vladimir Koushnir In case of errors, setting NULL in the entry of port_lid_tbl should be done only for LIDs assigned by lid manager in order to avoid unnecessary expansion of port_lid_tbl and further incorrect max_lid calculation that is based on port_lid_tbl vector size. Signed-off-by: Vladimir Koushnir Signed-off-by: Hal Rosenstock --- opensm/osm_state_mgr.c | 15 +++++++-------- 1 files changed, 7 insertions(+), 8 deletions(-) diff --git a/opensm/osm_state_mgr.c b/opensm/osm_state_mgr.c index 11e8353..3c76f62 100644 --- a/opensm/osm_state_mgr.c +++ b/opensm/osm_state_mgr.c @@ -1438,7 +1438,7 @@ static void state_mgr_check_tbl_consistency(IN osm_sm_t * sm) * same for this lid. Nothing to do. */ continue; - if (p_port_ref == NULL) + if (p_port_ref == NULL) { /* There is an object in the subnet database for this * lid, but no such object exists in the reference * port_list_tbl. This can occur if we wanted to assign @@ -1455,7 +1455,8 @@ static void state_mgr_check_tbl_consistency(IN osm_sm_t * sm) cl_ntoh64(osm_port_get_guid(p_port_stored)), p_port_stored->p_node->print_desc, p_port_stored->p_physp->port_num); - else if (p_port_stored == NULL) + cl_ptr_vector_set(p_port_lid_tbl, lid, NULL); + } else if (p_port_stored == NULL) /* There is an object in the new database, but no * object in our subnet database. This is the matching * case of the prior check - the port still has its @@ -1467,7 +1468,7 @@ static void state_mgr_check_tbl_consistency(IN osm_sm_t * sm) cl_ntoh64(osm_port_get_guid(p_port_ref)), p_port_ref->p_node->print_desc, p_port_ref->p_physp->port_num, lid); - else + else { /* if we reached here then p_port_stored != p_port_ref. * We were trying to set a lid to p_port_stored, but * it didn't reach it, and p_port_ref also didn't get @@ -1483,11 +1484,9 @@ static void state_mgr_check_tbl_consistency(IN osm_sm_t * sm) cl_ntoh64(osm_port_get_guid(p_port_stored)), p_port_stored->p_node->print_desc, p_port_stored->p_physp->port_num); - - /* In any of these cases we want to set NULL in the - * port_lid_tbl, since this entry is invalid. Also, make sure - * we'll do another heavy sweep. */ - cl_ptr_vector_set(p_port_lid_tbl, lid, NULL); + cl_ptr_vector_set(p_port_lid_tbl, lid, NULL); + } + /* Make sure we'll do another heavy sweep. */ sm->p_subn->subnet_initialization_error = TRUE; }