From patchwork Wed Aug 24 18:33:52 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislav Kinsbursky X-Patchwork-Id: 1093862 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p7OIZJHD022566 for ; Wed, 24 Aug 2011 18:35:19 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753953Ab1HXSfJ (ORCPT ); Wed, 24 Aug 2011 14:35:09 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:33682 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753930Ab1HXSfH (ORCPT ); Wed, 24 Aug 2011 14:35:07 -0400 Received: from localhost6.localdomain6 ([10.30.20.35]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id p7OIXrrj026967; Wed, 24 Aug 2011 22:33:54 +0400 (MSD) Subject: [PATCH 2/5] SUNRPC: use reference count helpers To: Trond.Myklebust@netapp.com From: Stanislav Kinsbursky Cc: linux-nfs@vger.kernel.org, xemul@parallels.com, neilb@suse.de, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bfields@fieldses.org, davem@davemloft.net Date: Wed, 24 Aug 2011 22:33:52 +0400 Message-ID: <20110824183352.4924.51863.stgit@localhost6.localdomain6> In-Reply-To: <20110824183304.4924.94670.stgit@localhost6.localdomain6> References: <20110824183304.4924.94670.stgit@localhost6.localdomain6> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 24 Aug 2011 18:35:19 +0000 (UTC) All is simple: we just increase users conters if rpcbind clients are present already. Otherwise we create new rpcbind clients and set users counter to 1. Signed-off-by: Stanislav Kinsbursky --- net/sunrpc/rpcb_clnt.c | 12 ++++-------- 1 files changed, 4 insertions(+), 8 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index c84e6a3..b4cc0f1 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c @@ -256,9 +256,7 @@ static int rpcb_create_local_unix(void) clnt4 = NULL; } - /* Protected by rpcb_create_local_mutex */ - rpcb_local_clnt = clnt; - rpcb_local_clnt4 = clnt4; + rpcb_set_local(clnt, clnt4); out: return result; @@ -310,9 +308,7 @@ static int rpcb_create_local_net(void) clnt4 = NULL; } - /* Protected by rpcb_create_local_mutex */ - rpcb_local_clnt = clnt; - rpcb_local_clnt4 = clnt4; + rpcb_set_local(clnt, clnt4); out: return result; @@ -327,11 +323,11 @@ static int rpcb_create_local(void) static DEFINE_MUTEX(rpcb_create_local_mutex); int result = 0; - if (rpcb_local_clnt) + if (rpcb_get_local()) return result; mutex_lock(&rpcb_create_local_mutex); - if (rpcb_local_clnt) + if (rpcb_get_local()) goto out; if (rpcb_create_local_unix() != 0)