NFSD: Using exp_get for export getting
authorKinglong Mee <kinglongmee@gmail.com>
Tue, 10 Jun 2014 14:06:44 +0000 (22:06 +0800)
committerJ. Bruce Fields <bfields@redhat.com>
Mon, 23 Jun 2014 15:31:36 +0000 (11:31 -0400)
Don't using cache_get besides export.h, using exp_get for export.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/export.c
fs/nfsd/export.h
fs/nfsd/nfs4proc.c
fs/nfsd/nfsfh.c
fs/nfsd/vfs.c

index ef2d9d62ce2bfd6766d760ac8722fe2b59498541..72ffd7cce3c39e743092b068d160a11d8f59f874 100644 (file)
@@ -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);
index cfeea85c5bed1f20bdc56e261423c6d95d6a8c7b..04dc8c167b0c198d41f18fb104daea752f4332b0 100644 (file)
@@ -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 *);
 
index be6734060d2aec103ff551714493c2b4f639113f..f3f048724ac7151d4d89d76a2b44b940b2e0f1d4 100644 (file)
@@ -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;
 }
index ec839341815477097f38ac6a5e81fb5738236697..6f5cc76a6c6e898e52fdd11db02327e8f0b0b4d4 100644 (file)
@@ -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 */
index 7498099b382f2caa9c5a7296313a5ecd3f11df29..df7cf61f2cd3c2cfad29bef2dcd13780242400d6 100644 (file)
@@ -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)) {