From patchwork Mon Apr 19 09:15:43 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Line.Holen@Sun.COM X-Patchwork-Id: 93445 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3J9G8Kx013076 for ; Mon, 19 Apr 2010 09:16:08 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751494Ab0DSJQF (ORCPT ); Mon, 19 Apr 2010 05:16:05 -0400 Received: from gmp-eb-inf-1.sun.com ([192.18.6.21]:54952 "EHLO gmp-eb-inf-1.sun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751066Ab0DSJQD (ORCPT ); Mon, 19 Apr 2010 05:16:03 -0400 Received: from fe-emea-10.sun.com (gmp-eb-lb-1-fe1.eu.sun.com [192.18.6.7] (may be forged)) by gmp-eb-inf-1.sun.com (8.13.7+Sun/8.12.9) with ESMTP id o3J9FvPw017934 for ; Mon, 19 Apr 2010 09:16:01 GMT MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-type: text/plain; CHARSET=US-ASCII Received: from conversion-daemon.fe-emea-10.sun.com by fe-emea-10.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul 2 2009)) id <0L14001009P10Q00@fe-emea-10.sun.com> for linux-rdma@vger.kernel.org; Mon, 19 Apr 2010 10:15:45 +0100 (BST) Received: from [129.159.138.95] ([unknown] [129.159.138.95]) by fe-emea-10.sun.com (Sun Java(tm) System Messaging Server 7u2-7.04 64bit (built Jul 2 2009)) with ESMTPSA id <0L14008EP9Q7UFC0@fe-emea-10.sun.com>; Mon, 19 Apr 2010 10:15:44 +0100 (BST) Date: Mon, 19 Apr 2010 11:15:43 +0200 From: Line Holen Subject: [PATCH] opensm/osm_sa_path_record.c: livelock in pr_rcv_get_path_parms To: sashak@voltaire.com Cc: linux-rdma@vger.kernel.org Message-id: <4BCC1F3F.5080000@Sun.COM> User-Agent: Thunderbird 2.0.0.23 (X11/20090910) Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 19 Apr 2010 09:16:08 +0000 (UTC) diff --git a/opensm/opensm/osm_sa_path_record.c b/opensm/opensm/osm_sa_path_record.c index c4c3f86..b399b70 100644 --- a/opensm/opensm/osm_sa_path_record.c +++ b/opensm/opensm/osm_sa_path_record.c @@ -4,6 +4,7 @@ * Copyright (c) 1996-2003 Intel Corporation. All rights reserved. * Copyright (c) 2008 Xsigo Systems Inc. All rights reserved. * Copyright (c) 2009 HNR Consulting. All rights reserved. + * Copyright (c) 2010 Sun Microsystems, Inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU @@ -69,6 +70,9 @@ #include #include + +#define MAX_HOPS 128 + typedef struct osm_pr_item { cl_list_item_t list_item; ib_path_rec_t path_rec; @@ -178,6 +182,7 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa, osm_qos_level_t *p_qos_level = NULL; uint16_t valid_sl_mask = 0xffff; int is_lash; + int hops = 0; OSM_LOG_ENTER(sa->p_log); @@ -369,6 +374,25 @@ static ib_api_status_t pr_rcv_get_path_parms(IN osm_sa_t * sa, goto Exit; } } + + /* update number of hops traversed */ + hops++; + if (hops > MAX_HOPS) { + + OSM_LOG(sa->p_log, OSM_LOG_ERROR, + "Path from GUID 0x%016" PRIx64 " (%s) to lid %u GUID 0x%016" + PRIx64 " (%s) needs more than %d hops, " + "max %d hops allowed\n", + cl_ntoh64(osm_physp_get_port_guid(p_src_physp)), + p_src_physp->p_node->print_desc, + dest_lid_ho, + cl_ntoh64(osm_physp_get_port_guid(p_dest_physp)), + p_dest_physp->p_node->print_desc, + hops, MAX_HOPS); + + status = IB_NOT_FOUND; + goto Exit; + } } /*