From patchwork Wed Jan 15 20:28:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hal Rosenstock X-Patchwork-Id: 3493661 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 043DF9F32F for ; Wed, 15 Jan 2014 20:29:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 386E220155 for ; Wed, 15 Jan 2014 20:29:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4D75220154 for ; Wed, 15 Jan 2014 20:28:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751747AbaAOU26 (ORCPT ); Wed, 15 Jan 2014 15:28:58 -0500 Received: from mail-ee0-f52.google.com ([74.125.83.52]:34687 "EHLO mail-ee0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751742AbaAOU26 (ORCPT ); Wed, 15 Jan 2014 15:28:58 -0500 Received: by mail-ee0-f52.google.com with SMTP id e53so1104504eek.25 for ; Wed, 15 Jan 2014 12:28:57 -0800 (PST) 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 :subject:content-type:content-transfer-encoding; bh=dW090DCChEJQJRuBlcZCR6lRr0nnf+xTUBnK5829BSU=; b=NL/wD7kETmMZ+d2JlIXwuH8JmoXP4I19s6RI6X9W5KAImJGqsRBoUxx/TXzw47HjLE DUb85rBHI9D/jCu3jG+fsomtI4WO0hAN6soriJKi9AUTTS5MKBZ3NqPiIoQQkUCawj5X Nx4K9PN88ttjHgcxtxGtVHhpWnyFYuF5q5R2wPbzPZdvrcVsjZBMldEE/2DKuVj30PIf q78iHax6x5LxOvDO1LgQ8pwhzo7WbGM8AvTxn77QR8QEOEH2BO9vxLjKKfUA6j21lJ8i rcdGlxl+Mpq0NbkwQM3vA52v6CUIHesBtFx1UbW59l9EA9SXLKURaIRikcQPqB69RaFH Xs1w== X-Gm-Message-State: ALoCoQmcIeXLr1URIt1XO0+4zisgTwIU3muFHr4S7djOWURQYjFau1XJzUyG8hALq/b6XBqDDZSW X-Received: by 10.14.113.199 with SMTP id a47mr6530478eeh.41.1389817737020; Wed, 15 Jan 2014 12:28:57 -0800 (PST) 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 x2sm10396176eeo.8.2014.01.15.12.28.56 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 15 Jan 2014 12:28:56 -0800 (PST) Message-ID: <52D6EF87.6000705@dev.mellanox.co.il> Date: Wed, 15 Jan 2014 15:28:55 -0500 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)" Subject: [PATCH opensm 3/4] osm_trap_rcv.c: Minimize time holding RW lock for, SystemImageGUID changed trap 145 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-7.2 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 From e7c4ec39fff6c6c243ac57434eb8f8bbe6f783f8 Mon Sep 17 00:00:00 2001 From: Hal Rosenstock Date: Thu, 15 Nov 2012 18:09:57 +0200 Subject: [PATCH 3/4] osm_trap_rcv.c: Minimize time holding RW lock for SystemImageGUID changed trap 145 Release RW lock after updating SystemImageGUID and reacquire RO lock Found-by: Vladimir Koushnir Signed-off-by: Hal Rosenstock --- opensm/osm_trap_rcv.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/opensm/osm_trap_rcv.c b/opensm/osm_trap_rcv.c index 27f3e4a..2623536 100644 --- a/opensm/osm_trap_rcv.c +++ b/opensm/osm_trap_rcv.c @@ -566,6 +566,8 @@ static void trap_rcv_process_request(IN osm_sm_t * sm, p_physp->p_node->node_info.sys_guid = p_ntci->data_details.ntc_145.new_sys_guid; } + CL_PLOCK_RELEASE(sm->p_lock); + CL_PLOCK_ACQUIRE(sm->p_lock); } else OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 3813: No physical port found for "