From patchwork Tue Jul 3 16:20:44 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislav Kinsbursky X-Patchwork-Id: 1152211 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id E36EEDFF72 for ; Tue, 3 Jul 2012 16:24:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933167Ab2GCQYB (ORCPT ); Tue, 3 Jul 2012 12:24:01 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:19223 "EHLO relay.sw.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932123Ab2GCQYA (ORCPT ); Tue, 3 Jul 2012 12:24:00 -0400 Received: from localhost.localdomain ([10.30.21.131]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id q63GNn3N029024; Tue, 3 Jul 2012 20:23:50 +0400 (MSK) Subject: [PATCH v3 11/11] NFS: get net after idr allocation To: bfields@fieldses.org From: Stanislav Kinsbursky Cc: linux-nfs@vger.kernel.org, Trond.Myklebust@netapp.com, linux-kernel@vger.kernel.org, devel@openvz.org Date: Tue, 03 Jul 2012 20:20:44 +0400 Message-ID: <20120703162044.11911.6064.stgit@localhost.localdomain> In-Reply-To: <20120703161844.11911.92996.stgit@localhost.localdomain> References: <20120703161844.11911.92996.stgit@localhost.localdomain> User-Agent: StGit/0.16 MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Allocation can fail. So instead of put net in case of failure, get net after allocation. Signed-off-by: Stanislav Kinsbursky --- fs/nfs/client.c | 3 ++- 1 files changed, 2 insertions(+), 1 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/fs/nfs/client.c b/fs/nfs/client.c index d8c918b..d17aa10 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -175,7 +175,7 @@ static struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_ clp->cl_rpcclient = ERR_PTR(-EINVAL); clp->cl_proto = cl_init->proto; - clp->cl_net = get_net(cl_init->net); + clp->cl_net = cl_init->net; #ifdef CONFIG_NFS_V4 err = nfs_get_cb_ident_idr(clp, cl_init->minorversion); @@ -189,6 +189,7 @@ static struct nfs_client *nfs_alloc_client(const struct nfs_client_initdata *cl_ clp->cl_minorversion = cl_init->minorversion; clp->cl_mvops = nfs_v4_minor_ops[cl_init->minorversion]; #endif + get_net(clp->cl_net); cred = rpc_lookup_machine_cred("*"); if (!IS_ERR(cred)) clp->cl_machine_cred = cred;