From patchwork Wed Feb 26 10:52:01 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Netes X-Patchwork-Id: 3724031 X-Patchwork-Delegate: hal@mellanox.com Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 2E691BF13A for ; Wed, 26 Feb 2014 12:54:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 49A2B2017B for ; Wed, 26 Feb 2014 12:54:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 34CDE20155 for ; Wed, 26 Feb 2014 12:54:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751114AbaBZMy3 (ORCPT ); Wed, 26 Feb 2014 07:54:29 -0500 Received: from mail-wg0-f52.google.com ([74.125.82.52]:51004 "EHLO mail-wg0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751080AbaBZMy2 (ORCPT ); Wed, 26 Feb 2014 07:54:28 -0500 Received: by mail-wg0-f52.google.com with SMTP id k14so1630928wgh.35 for ; Wed, 26 Feb 2014 04:54:27 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=MkFh7IKykYd2yrsFZtCmXFaVGu59yyM1IjPp/8gqC3I=; b=FCq7bb/WeenoXUCU4SP/G9ZT+WQjGaCZJEfwvHj0av7uORnqeOv7neTy6cQC+MY0zg 3OK6lMRRbzOGYe9QNQhyFm3yKQDxr2OG8cuwz4t6ZUBldE0HyPrajVI7/VZ2a1AOn10j wa+JZ/u+Pvvi+12uby7QklIgtb7jlzSAmv2SYuFGuFMfzXzwojacV1yQafPe/BwIxg5T LLP47ViZKzyS988AltJM7XWkiR67th2aF8qFGYm2dx4krTIGlOWDSnVuPOuGbXVNraPv OQMnKi9fIc8etJZ7e17EEXjSUZHDKv+Xxg5Hkhlx5pNSzrh526K18nVJ32LCZZE5F4BV DGVw== X-Gm-Message-State: ALoCoQnIA+vpmVao5QxUMkXVKz2ki9v1t0HjYvcx79EIk5fkdpO3yrGEYI2cAPKFtR+FGH5DyI+Z X-Received: by 10.180.25.46 with SMTP id z14mr7706679wif.49.1393419267791; Wed, 26 Feb 2014 04:54:27 -0800 (PST) Received: from localhost (out.voltaire.com. [193.47.165.251]) by mx.google.com with ESMTPSA id fs4sm5178780wib.11.2014.02.26.04.54.26 for (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Wed, 26 Feb 2014 04:54:27 -0800 (PST) From: Alex Netes To: linux-rdma@vger.kernel.org, Hal Rosenstock Cc: Alex Netes Subject: [PATCH] opensm/osm_sa_path_record.c: Search for requester port should be under lock Date: Wed, 26 Feb 2014 12:52:01 +0200 Message-Id: <1393411921-25229-1-git-send-email-alexne@mellanox.com> X-Mailer: git-send-email 1.7.1 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, 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 It might colide with the sweep operations. Signed-off-by: Alex Netes --- opensm/osm_sa_path_record.c | 35 ++++++++++++++++++----------------- 1 files changed, 18 insertions(+), 17 deletions(-) diff --git a/opensm/osm_sa_path_record.c b/opensm/osm_sa_path_record.c index d9c59b8..203cfc0 100644 --- a/opensm/osm_sa_path_record.c +++ b/opensm/osm_sa_path_record.c @@ -1727,23 +1727,6 @@ void osm_pr_rcv_process(IN void *context, IN void *data) goto Exit; } - /* update the requester physical port */ - requester_port = osm_get_port_by_mad_addr(sa->p_log, sa->p_subn, - osm_madw_get_mad_addr_ptr - (p_madw)); - if (requester_port == NULL) { - OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F16: " - "Cannot find requester physical port\n"); - goto Exit; - } - - if (OSM_LOG_IS_ACTIVE_V2(sa->p_log, OSM_LOG_DEBUG)) { - OSM_LOG(sa->p_log, OSM_LOG_DEBUG, - "Requester port GUID 0x%" PRIx64 "\n", - cl_ntoh64(osm_port_get_guid(requester_port))); - osm_dump_path_record_v2(sa->p_log, p_pr, FILE_ID, OSM_LOG_DEBUG); - } - /* Validate rate if supplied */ if ((p_sa_mad->comp_mask & IB_PR_COMPMASK_RATESELEC) && (p_sa_mad->comp_mask & IB_PR_COMPMASK_RATE)) { @@ -1781,6 +1764,24 @@ void osm_pr_rcv_process(IN void *context, IN void *data) */ cl_plock_acquire(sa->p_lock); + /* update the requester physical port */ + requester_port = osm_get_port_by_mad_addr(sa->p_log, sa->p_subn, + osm_madw_get_mad_addr_ptr + (p_madw)); + if (requester_port == NULL) { + OSM_LOG(sa->p_log, OSM_LOG_ERROR, "ERR 1F16: " + "Cannot find requester physical port\n"); + cl_plock_release(sa->p_lock); + goto Exit; + } + + if (OSM_LOG_IS_ACTIVE_V2(sa->p_log, OSM_LOG_DEBUG)) { + OSM_LOG(sa->p_log, OSM_LOG_DEBUG, + "Requester port GUID 0x%" PRIx64 "\n", + cl_ntoh64(osm_port_get_guid(requester_port))); + osm_dump_path_record_v2(sa->p_log, p_pr, FILE_ID, OSM_LOG_DEBUG); + } + /* Handle multicast destinations separately */ if ((p_sa_mad->comp_mask & IB_PR_COMPMASK_DGID) && ib_gid_is_multicast(&p_pr->dgid)) {