From patchwork Tue Jun 10 14:06:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 4329111 Return-Path: X-Original-To: patchwork-linux-nfs@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 DE4D59F3B4 for ; Tue, 10 Jun 2014 14:06:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BD60E20295 for ; Tue, 10 Jun 2014 14:06:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BEA84201F5 for ; Tue, 10 Jun 2014 14:06:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752276AbaFJOGw (ORCPT ); Tue, 10 Jun 2014 10:06:52 -0400 Received: from mail-pb0-f48.google.com ([209.85.160.48]:42033 "EHLO mail-pb0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751276AbaFJOGw (ORCPT ); Tue, 10 Jun 2014 10:06:52 -0400 Received: by mail-pb0-f48.google.com with SMTP id rr13so6286590pbb.35 for ; Tue, 10 Jun 2014 07:06:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; bh=VESCnvN9tarAf4f/V/eZwJl3T6++3GjD1gsrOUOGUco=; b=HnZ4N84n5I/ngZULJRgMX2PZ4r8IiXcF89LRw9vdJ0eRI/glSJM1mhscHDkNUza7At V7MtW6SMHjs7RukLxmQkzcREVpnKP1ECOi40dnXpW39OurUFaKXovsjqXy5Y7iT02mQD 9Aadg/SD+RAb7t50SjcsThElyiSYPA4IPTDja1MURsRmPJNeG5cAzHi9I15o8KVm4wfV gBQHBvOybx0/dZMfKczz4EOy6JWsMJ28AB5F33kzweK8dcve5GWoQdo71Mk38WmYP0fw LL3+8VM8D5hVcFVNnFHpusHLzqmObcC4WID7mudbssSQMX50WHpri7ffl/5rrasSCR65 jIVA== X-Received: by 10.68.189.232 with SMTP id gl8mr12053283pbc.89.1402409211703; Tue, 10 Jun 2014 07:06:51 -0700 (PDT) Received: from [192.168.31.158] ([125.67.97.90]) by mx.google.com with ESMTPSA id om6sm69768215pbc.43.2014.06.10.07.06.47 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Jun 2014 07:06:50 -0700 (PDT) Message-ID: <539710F4.6060806@gmail.com> Date: Tue, 10 Jun 2014 22:06:44 +0800 From: Kinglong Mee User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 MIME-Version: 1.0 To: "J. Bruce Fields" CC: Linux NFS Mailing List , kinglongmee@gmail.com Subject: [PATCH] NFSD: Using exp_get for export getting Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, 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 Don't using cache_get besides export.h, using exp_get for export. Signed-off-by: Kinglong Mee --- fs/nfsd/export.c | 2 +- fs/nfsd/export.h | 3 ++- fs/nfsd/nfs4proc.c | 6 +++--- fs/nfsd/nfsfh.c | 3 +-- fs/nfsd/vfs.c | 3 +-- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c index ef2d9d6..72ffd7c 100644 --- a/fs/nfsd/export.c +++ b/fs/nfsd/export.c @@ -1253,7 +1253,7 @@ static int e_show(struct seq_file *m, void *p) return 0; } - cache_get(&exp->h); + exp_get(exp); if (cache_check(cd, &exp->h, NULL)) return 0; exp_put(exp); diff --git a/fs/nfsd/export.h b/fs/nfsd/export.h index cfeea85..04dc8c1 100644 --- a/fs/nfsd/export.h +++ b/fs/nfsd/export.h @@ -101,9 +101,10 @@ static inline void exp_put(struct svc_export *exp) cache_put(&exp->h, exp->cd); } -static inline void exp_get(struct svc_export *exp) +static inline struct svc_export *exp_get(struct svc_export *exp) { cache_get(&exp->h); + return exp; } struct svc_export * rqst_exp_find(struct svc_rqst *, int, u32 *); diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c index be67340..f3f0487 100644 --- a/fs/nfsd/nfs4proc.c +++ b/fs/nfsd/nfs4proc.c @@ -177,7 +177,7 @@ fh_dup2(struct svc_fh *dst, struct svc_fh *src) fh_put(dst); dget(src->fh_dentry); if (src->fh_export) - cache_get(&src->fh_export->h); + exp_get(src->fh_export); *dst = *src; } @@ -918,8 +918,8 @@ nfsd4_secinfo_no_name(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstat default: return nfserr_inval; } - exp_get(cstate->current_fh.fh_export); - sin->sin_exp = cstate->current_fh.fh_export; + + sin->sin_exp = exp_get(cstate->current_fh.fh_export); fh_put(&cstate->current_fh); return nfs_ok; } diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c index ec83934..6f5cc76 100644 --- a/fs/nfsd/nfsfh.c +++ b/fs/nfsd/nfsfh.c @@ -539,8 +539,7 @@ fh_compose(struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, dentry); fhp->fh_dentry = dget(dentry); /* our internal copy */ - fhp->fh_export = exp; - cache_get(&exp->h); + fhp->fh_export = exp_get(exp); if (fhp->fh_handle.fh_version == 0xca) { /* old style filehandle please */ diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 7498099..df7cf61 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -189,8 +189,7 @@ nfsd_lookup_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp, dprintk("nfsd: nfsd_lookup(fh %s, %.*s)\n", SVCFH_fmt(fhp), len,name); dparent = fhp->fh_dentry; - exp = fhp->fh_export; - exp_get(exp); + exp = exp_get(fhp->fh_export); /* Lookup the name, but don't follow links */ if (isdotent(name, len)) {