aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Blunck <jblunck@suse.de>2008-02-14 22:38:41 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-15 00:17:08 -0500
commite83aece3afad4d56cc01abe069d3519e851cd2de (patch)
tree360f38ea9f656205941bc98aab93121b67f0a81f
parent5477549161480432d053565d2720f08626baf9e3 (diff)
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>
-rw-r--r--fs/nfsd/export.c30
-rw-r--r--include/linux/nfsd/export.h3
2 files changed, 14 insertions, 19 deletions
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 7d7896814fa4..b59f8590af47 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -63,10 +63,8 @@ static void expkey_put(struct kref *ref)
63 struct svc_expkey *key = container_of(ref, struct svc_expkey, h.ref); 63 struct svc_expkey *key = container_of(ref, struct svc_expkey, h.ref);
64 64
65 if (test_bit(CACHE_VALID, &key->h.flags) && 65 if (test_bit(CACHE_VALID, &key->h.flags) &&
66 !test_bit(CACHE_NEGATIVE, &key->h.flags)) { 66 !test_bit(CACHE_NEGATIVE, &key->h.flags))
67 dput(key->ek_dentry); 67 path_put(&key->ek_path);
68 mntput(key->ek_mnt);
69 }
70 auth_domain_put(key->ek_client); 68 auth_domain_put(key->ek_client);
71 kfree(key); 69 kfree(key);
72} 70}
@@ -169,9 +167,8 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
169 goto out; 167 goto out;
170 168
171 dprintk("Found the path %s\n", buf); 169 dprintk("Found the path %s\n", buf);
172 key.ek_mnt = nd.path.mnt; 170 key.ek_path = nd.path;
173 key.ek_dentry = nd.path.dentry; 171
174
175 ek = svc_expkey_update(&key, ek); 172 ek = svc_expkey_update(&key, ek);
176 if (ek) 173 if (ek)
177 cache_put(&ek->h, &svc_expkey_cache); 174 cache_put(&ek->h, &svc_expkey_cache);
@@ -206,7 +203,7 @@ static int expkey_show(struct seq_file *m,
206 if (test_bit(CACHE_VALID, &h->flags) && 203 if (test_bit(CACHE_VALID, &h->flags) &&
207 !test_bit(CACHE_NEGATIVE, &h->flags)) { 204 !test_bit(CACHE_NEGATIVE, &h->flags)) {
208 seq_printf(m, " "); 205 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");
210 } 207 }
211 seq_printf(m, "\n"); 208 seq_printf(m, "\n");
212 return 0; 209 return 0;
@@ -243,8 +240,8 @@ static inline void expkey_update(struct cache_head *cnew,
243 struct svc_expkey *new = container_of(cnew, struct svc_expkey, h); 240 struct svc_expkey *new = container_of(cnew, struct svc_expkey, h);
244 struct svc_expkey *item = container_of(citem, struct svc_expkey, h); 241 struct svc_expkey *item = container_of(citem, struct svc_expkey, h);
245 242
246 new->ek_mnt = mntget(item->ek_mnt); 243 new->ek_path = item->ek_path;
247 new->ek_dentry = dget(item->ek_dentry); 244 path_get(&item->ek_path);
248} 245}
249 246
250static struct cache_head *expkey_alloc(void) 247static struct cache_head *expkey_alloc(void)
@@ -814,8 +811,7 @@ static int exp_set_key(svc_client *clp, int fsid_type, u32 *fsidv,
814 key.ek_client = clp; 811 key.ek_client = clp;
815 key.ek_fsidtype = fsid_type; 812 key.ek_fsidtype = fsid_type;
816 memcpy(key.ek_fsid, fsidv, key_len(fsid_type)); 813 memcpy(key.ek_fsid, fsidv, key_len(fsid_type));
817 key.ek_mnt = exp->ex_path.mnt; 814 key.ek_path = exp->ex_path;
818 key.ek_dentry = exp->ex_path.dentry;
819 key.h.expiry_time = NEVER; 815 key.h.expiry_time = NEVER;
820 key.h.flags = 0; 816 key.h.flags = 0;
821 817
@@ -864,7 +860,7 @@ static svc_export *exp_get_by_name(svc_client *clp, struct vfsmount *mnt,
864{ 860{
865 struct svc_export *exp, key; 861 struct svc_export *exp, key;
866 int err; 862 int err;
867 863
868 if (!clp) 864 if (!clp)
869 return ERR_PTR(-ENOENT); 865 return ERR_PTR(-ENOENT);
870 866
@@ -1036,9 +1032,9 @@ exp_export(struct nfsctl_export *nxp)
1036 /* must make sure there won't be an ex_fsid clash */ 1032 /* must make sure there won't be an ex_fsid clash */
1037 if ((nxp->ex_flags & NFSEXP_FSID) && 1033 if ((nxp->ex_flags & NFSEXP_FSID) &&
1038 (!IS_ERR(fsid_key = exp_get_fsid_key(clp, nxp->ex_dev))) && 1034 (!IS_ERR(fsid_key = exp_get_fsid_key(clp, nxp->ex_dev))) &&
1039 fsid_key->ek_mnt && 1035 fsid_key->ek_path.mnt &&
1040 (fsid_key->ek_mnt != nd.path.mnt || 1036 (fsid_key->ek_path.mnt != nd.path.mnt ||
1041 fsid_key->ek_dentry != nd.path.dentry)) 1037 fsid_key->ek_path.dentry != nd.path.dentry))
1042 goto finish; 1038 goto finish;
1043 1039
1044 if (!IS_ERR(exp)) { 1040 if (!IS_ERR(exp)) {
@@ -1218,7 +1214,7 @@ static struct svc_export *exp_find(struct auth_domain *clp, int fsid_type,
1218 if (IS_ERR(ek)) 1214 if (IS_ERR(ek))
1219 return ERR_CAST(ek); 1215 return ERR_CAST(ek);
1220 1216
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);
1222 cache_put(&ek->h, &svc_expkey_cache); 1218 cache_put(&ek->h, &svc_expkey_cache);
1223 1219
1224 if (IS_ERR(exp)) 1220 if (IS_ERR(exp))
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
index 491dec1e37ca..5431512b2757 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
@@ -106,8 +106,7 @@ struct svc_expkey {
106 int ek_fsidtype; 106 int ek_fsidtype;
107 u32 ek_fsid[6]; 107 u32 ek_fsid[6];
108 108
109 struct vfsmount * ek_mnt; 109 struct path ek_path;
110 struct dentry * ek_dentry;
111}; 110};
112 111
113#define EX_SECURE(exp) (!((exp)->ex_flags & NFSEXP_INSECURE_PORT)) 112#define EX_SECURE(exp) (!((exp)->ex_flags & NFSEXP_INSECURE_PORT))