Skip to content

Commit e83aece

Browse files
Jan BlunckLinus Torvalds
authored andcommitted
Use struct path in struct svc_expkey
I'm embedding struct path into struct svc_expkey. Signed-off-by: Jan Blunck <jblunck@suse.de> Cc: Al Viro <viro@zeniv.linux.org.uk> Acked-by: "J. Bruce Fields" <bfields@fieldses.org> Cc: Neil Brown <neilb@suse.de> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 5477549 commit e83aece

2 files changed

Lines changed: 14 additions & 19 deletions

File tree

‎fs/nfsd/export.c‎

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,8 @@ static void expkey_put(struct kref *ref)
6363
struct svc_expkey *key = container_of(ref, struct svc_expkey, h.ref);
6464

6565
if (test_bit(CACHE_VALID, &key->h.flags) &&
66-
!test_bit(CACHE_NEGATIVE, &key->h.flags)) {
67-
dput(key->ek_dentry);
68-
mntput(key->ek_mnt);
69-
}
66+
!test_bit(CACHE_NEGATIVE, &key->h.flags))
67+
path_put(&key->ek_path);
7068
auth_domain_put(key->ek_client);
7169
kfree(key);
7270
}
@@ -169,9 +167,8 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
169167
goto out;
170168

171169
dprintk("Found the path %s\n", buf);
172-
key.ek_mnt = nd.path.mnt;
173-
key.ek_dentry = nd.path.dentry;
174-
170+
key.ek_path = nd.path;
171+
175172
ek = svc_expkey_update(&key, ek);
176173
if (ek)
177174
cache_put(&ek->h, &svc_expkey_cache);
@@ -206,7 +203,7 @@ static int expkey_show(struct seq_file *m,
206203
if (test_bit(CACHE_VALID, &h->flags) &&
207204
!test_bit(CACHE_NEGATIVE, &h->flags)) {
208205
seq_printf(m, " ");
209-
seq_path(m, ek->ek_mnt, ek->ek_dentry, "\\ \t\n");
206+
seq_path(m, ek->ek_path.mnt, ek->ek_path.dentry, "\\ \t\n");
210207
}
211208
seq_printf(m, "\n");
212209
return 0;
@@ -243,8 +240,8 @@ static inline void expkey_update(struct cache_head *cnew,
243240
struct svc_expkey *new = container_of(cnew, struct svc_expkey, h);
244241
struct svc_expkey *item = container_of(citem, struct svc_expkey, h);
245242

246-
new->ek_mnt = mntget(item->ek_mnt);
247-
new->ek_dentry = dget(item->ek_dentry);
243+
new->ek_path = item->ek_path;
244+
path_get(&item->ek_path);
248245
}
249246

250247
static struct cache_head *expkey_alloc(void)
@@ -814,8 +811,7 @@ static int exp_set_key(svc_client *clp, int fsid_type, u32 *fsidv,
814811
key.ek_client = clp;
815812
key.ek_fsidtype = fsid_type;
816813
memcpy(key.ek_fsid, fsidv, key_len(fsid_type));
817-
key.ek_mnt = exp->ex_path.mnt;
818-
key.ek_dentry = exp->ex_path.dentry;
814+
key.ek_path = exp->ex_path;
819815
key.h.expiry_time = NEVER;
820816
key.h.flags = 0;
821817

@@ -864,7 +860,7 @@ static svc_export *exp_get_by_name(svc_client *clp, struct vfsmount *mnt,
864860
{
865861
struct svc_export *exp, key;
866862
int err;
867-
863+
868864
if (!clp)
869865
return ERR_PTR(-ENOENT);
870866

@@ -1036,9 +1032,9 @@ exp_export(struct nfsctl_export *nxp)
10361032
/* must make sure there won't be an ex_fsid clash */
10371033
if ((nxp->ex_flags & NFSEXP_FSID) &&
10381034
(!IS_ERR(fsid_key = exp_get_fsid_key(clp, nxp->ex_dev))) &&
1039-
fsid_key->ek_mnt &&
1040-
(fsid_key->ek_mnt != nd.path.mnt ||
1041-
fsid_key->ek_dentry != nd.path.dentry))
1035+
fsid_key->ek_path.mnt &&
1036+
(fsid_key->ek_path.mnt != nd.path.mnt ||
1037+
fsid_key->ek_path.dentry != nd.path.dentry))
10421038
goto finish;
10431039

10441040
if (!IS_ERR(exp)) {
@@ -1218,7 +1214,7 @@ static struct svc_export *exp_find(struct auth_domain *clp, int fsid_type,
12181214
if (IS_ERR(ek))
12191215
return ERR_CAST(ek);
12201216

1221-
exp = exp_get_by_name(clp, ek->ek_mnt, ek->ek_dentry, reqp);
1217+
exp = exp_get_by_name(clp, ek->ek_path.mnt, ek->ek_path.dentry, reqp);
12221218
cache_put(&ek->h, &svc_expkey_cache);
12231219

12241220
if (IS_ERR(exp))

‎include/linux/nfsd/export.h‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ struct svc_expkey {
106106
int ek_fsidtype;
107107
u32 ek_fsid[6];
108108

109-
struct vfsmount * ek_mnt;
110-
struct dentry * ek_dentry;
109+
struct path ek_path;
111110
};
112111

113112
#define EX_SECURE(exp) (!((exp)->ex_flags & NFSEXP_INSECURE_PORT))

0 commit comments

Comments
 (0)