aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/export.c
diff options
context:
space:
mode:
authorJan Blunck <jblunck@suse.de>2008-02-14 22:34:32 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-15 00:13:33 -0500
commit4ac9137858e08a19f29feac4e1f4df7c268b0ba5 (patch)
treef5b5d84fd12fcc2b0ba0e7ce1a79ff381ad8f5dd /fs/nfsd/export.c
parentc5e725f33b733a77de622e91b6ba5645fcf070be (diff)
Embed a struct path into struct nameidata instead of nd->{dentry,mnt}
This is the central patch of a cleanup series. In most cases there is no good reason why someone would want to use a dentry for itself. This series reflects that fact and embeds a struct path into nameidata. Together with the other patches of this series - it enforced the correct order of getting/releasing the reference count on <dentry,vfsmount> pairs - it prepares the VFS for stacking support since it is essential to have a struct path in every place where the stack can be traversed - it reduces the overall code size: without patch series: text data bss dec hex filename 5321639 858418 715768 6895825 6938d1 vmlinux with patch series: text data bss dec hex filename 5320026 858418 715768 6894212 693284 vmlinux This patch: Switch from nd->{dentry,mnt} to nd->path.{dentry,mnt} everywhere. [akpm@linux-foundation.org: coding-style fixes] [akpm@linux-foundation.org: fix cifs] [akpm@linux-foundation.org: fix smack] Signed-off-by: Jan Blunck <jblunck@suse.de> Signed-off-by: Andreas Gruenbacher <agruen@suse.de> Acked-by: Christoph Hellwig <hch@lst.de> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Casey Schaufler <casey@schaufler-ca.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/nfsd/export.c')
-rw-r--r--fs/nfsd/export.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 346570f6d848..2ac0e30285c2 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -169,8 +169,8 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
169 goto out; 169 goto out;
170 170
171 dprintk("Found the path %s\n", buf); 171 dprintk("Found the path %s\n", buf);
172 key.ek_mnt = nd.mnt; 172 key.ek_mnt = nd.path.mnt;
173 key.ek_dentry = nd.dentry; 173 key.ek_dentry = nd.path.dentry;
174 174
175 ek = svc_expkey_update(&key, ek); 175 ek = svc_expkey_update(&key, ek);
176 if (ek) 176 if (ek)
@@ -507,7 +507,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
507 struct svc_export exp, *expp; 507 struct svc_export exp, *expp;
508 int an_int; 508 int an_int;
509 509
510 nd.dentry = NULL; 510 nd.path.dentry = NULL;
511 exp.ex_path = NULL; 511 exp.ex_path = NULL;
512 512
513 /* fs locations */ 513 /* fs locations */
@@ -547,8 +547,8 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
547 547
548 exp.h.flags = 0; 548 exp.h.flags = 0;
549 exp.ex_client = dom; 549 exp.ex_client = dom;
550 exp.ex_mnt = nd.mnt; 550 exp.ex_mnt = nd.path.mnt;
551 exp.ex_dentry = nd.dentry; 551 exp.ex_dentry = nd.path.dentry;
552 exp.ex_path = kstrdup(buf, GFP_KERNEL); 552 exp.ex_path = kstrdup(buf, GFP_KERNEL);
553 err = -ENOMEM; 553 err = -ENOMEM;
554 if (!exp.ex_path) 554 if (!exp.ex_path)
@@ -610,7 +610,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
610 goto out; 610 goto out;
611 } 611 }
612 612
613 err = check_export(nd.dentry->d_inode, exp.ex_flags, 613 err = check_export(nd.path.dentry->d_inode, exp.ex_flags,
614 exp.ex_uuid); 614 exp.ex_uuid);
615 if (err) goto out; 615 if (err) goto out;
616 } 616 }
@@ -629,7 +629,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
629 nfsd4_fslocs_free(&exp.ex_fslocs); 629 nfsd4_fslocs_free(&exp.ex_fslocs);
630 kfree(exp.ex_uuid); 630 kfree(exp.ex_uuid);
631 kfree(exp.ex_path); 631 kfree(exp.ex_path);
632 if (nd.dentry) 632 if (nd.path.dentry)
633 path_release(&nd); 633 path_release(&nd);
634 out_no_path: 634 out_no_path:
635 if (dom) 635 if (dom)
@@ -1030,7 +1030,7 @@ exp_export(struct nfsctl_export *nxp)
1030 goto out_unlock; 1030 goto out_unlock;
1031 err = -EINVAL; 1031 err = -EINVAL;
1032 1032
1033 exp = exp_get_by_name(clp, nd.mnt, nd.dentry, NULL); 1033 exp = exp_get_by_name(clp, nd.path.mnt, nd.path.dentry, NULL);
1034 1034
1035 memset(&new, 0, sizeof(new)); 1035 memset(&new, 0, sizeof(new));
1036 1036
@@ -1038,7 +1038,8 @@ exp_export(struct nfsctl_export *nxp)
1038 if ((nxp->ex_flags & NFSEXP_FSID) && 1038 if ((nxp->ex_flags & NFSEXP_FSID) &&
1039 (!IS_ERR(fsid_key = exp_get_fsid_key(clp, nxp->ex_dev))) && 1039 (!IS_ERR(fsid_key = exp_get_fsid_key(clp, nxp->ex_dev))) &&
1040 fsid_key->ek_mnt && 1040 fsid_key->ek_mnt &&
1041 (fsid_key->ek_mnt != nd.mnt || fsid_key->ek_dentry != nd.dentry) ) 1041 (fsid_key->ek_mnt != nd.path.mnt ||
1042 fsid_key->ek_dentry != nd.path.dentry))
1042 goto finish; 1043 goto finish;
1043 1044
1044 if (!IS_ERR(exp)) { 1045 if (!IS_ERR(exp)) {
@@ -1054,7 +1055,7 @@ exp_export(struct nfsctl_export *nxp)
1054 goto finish; 1055 goto finish;
1055 } 1056 }
1056 1057
1057 err = check_export(nd.dentry->d_inode, nxp->ex_flags, NULL); 1058 err = check_export(nd.path.dentry->d_inode, nxp->ex_flags, NULL);
1058 if (err) goto finish; 1059 if (err) goto finish;
1059 1060
1060 err = -ENOMEM; 1061 err = -ENOMEM;
@@ -1067,8 +1068,8 @@ exp_export(struct nfsctl_export *nxp)
1067 if (!new.ex_path) 1068 if (!new.ex_path)
1068 goto finish; 1069 goto finish;
1069 new.ex_client = clp; 1070 new.ex_client = clp;
1070 new.ex_mnt = nd.mnt; 1071 new.ex_mnt = nd.path.mnt;
1071 new.ex_dentry = nd.dentry; 1072 new.ex_dentry = nd.path.dentry;
1072 new.ex_flags = nxp->ex_flags; 1073 new.ex_flags = nxp->ex_flags;
1073 new.ex_anon_uid = nxp->ex_anon_uid; 1074 new.ex_anon_uid = nxp->ex_anon_uid;
1074 new.ex_anon_gid = nxp->ex_anon_gid; 1075 new.ex_anon_gid = nxp->ex_anon_gid;
@@ -1148,7 +1149,7 @@ exp_unexport(struct nfsctl_export *nxp)
1148 goto out_domain; 1149 goto out_domain;
1149 1150
1150 err = -EINVAL; 1151 err = -EINVAL;
1151 exp = exp_get_by_name(dom, nd.mnt, nd.dentry, NULL); 1152 exp = exp_get_by_name(dom, nd.path.mnt, nd.path.dentry, NULL);
1152 path_release(&nd); 1153 path_release(&nd);
1153 if (IS_ERR(exp)) 1154 if (IS_ERR(exp))
1154 goto out_domain; 1155 goto out_domain;
@@ -1185,12 +1186,12 @@ exp_rootfh(svc_client *clp, char *path, struct knfsd_fh *f, int maxsize)
1185 printk("nfsd: exp_rootfh path not found %s", path); 1186 printk("nfsd: exp_rootfh path not found %s", path);
1186 return err; 1187 return err;
1187 } 1188 }
1188 inode = nd.dentry->d_inode; 1189 inode = nd.path.dentry->d_inode;
1189 1190
1190 dprintk("nfsd: exp_rootfh(%s [%p] %s:%s/%ld)\n", 1191 dprintk("nfsd: exp_rootfh(%s [%p] %s:%s/%ld)\n",
1191 path, nd.dentry, clp->name, 1192 path, nd.path.dentry, clp->name,
1192 inode->i_sb->s_id, inode->i_ino); 1193 inode->i_sb->s_id, inode->i_ino);
1193 exp = exp_parent(clp, nd.mnt, nd.dentry, NULL); 1194 exp = exp_parent(clp, nd.path.mnt, nd.path.dentry, NULL);
1194 if (IS_ERR(exp)) { 1195 if (IS_ERR(exp)) {
1195 err = PTR_ERR(exp); 1196 err = PTR_ERR(exp);
1196 goto out; 1197 goto out;
@@ -1200,7 +1201,7 @@ exp_rootfh(svc_client *clp, char *path, struct knfsd_fh *f, int maxsize)
1200 * fh must be initialized before calling fh_compose 1201 * fh must be initialized before calling fh_compose
1201 */ 1202 */
1202 fh_init(&fh, maxsize); 1203 fh_init(&fh, maxsize);
1203 if (fh_compose(&fh, exp, nd.dentry, NULL)) 1204 if (fh_compose(&fh, exp, nd.path.dentry, NULL))
1204 err = -EINVAL; 1205 err = -EINVAL;
1205 else 1206 else
1206 err = 0; 1207 err = 0;