aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/export.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfsd/export.c')
-rw-r--r--fs/nfsd/export.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index f37df46d2eaa..248dd92e6a56 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -787,15 +787,20 @@ exp_get_by_name(svc_client *clp, struct vfsmount *mnt, struct dentry *dentry,
787 key.ex_dentry = dentry; 787 key.ex_dentry = dentry;
788 788
789 exp = svc_export_lookup(&key); 789 exp = svc_export_lookup(&key);
790 if (exp != NULL) 790 if (exp != NULL) {
791 switch (cache_check(&svc_export_cache, &exp->h, reqp)) { 791 int err;
792
793 err = cache_check(&svc_export_cache, &exp->h, reqp);
794 switch (err) {
792 case 0: break; 795 case 0: break;
793 case -EAGAIN: 796 case -EAGAIN:
794 exp = ERR_PTR(-EAGAIN); 797 case -ETIMEDOUT:
798 exp = ERR_PTR(err);
795 break; 799 break;
796 default: 800 default:
797 exp = NULL; 801 exp = NULL;
798 } 802 }
803 }
799 804
800 return exp; 805 return exp;
801} 806}
@@ -950,6 +955,8 @@ exp_export(struct nfsctl_export *nxp)
950 955
951 exp = exp_get_by_name(clp, nd.mnt, nd.dentry, NULL); 956 exp = exp_get_by_name(clp, nd.mnt, nd.dentry, NULL);
952 957
958 memset(&new, 0, sizeof(new));
959
953 /* must make sure there won't be an ex_fsid clash */ 960 /* must make sure there won't be an ex_fsid clash */
954 if ((nxp->ex_flags & NFSEXP_FSID) && 961 if ((nxp->ex_flags & NFSEXP_FSID) &&
955 (fsid_key = exp_get_fsid_key(clp, nxp->ex_dev)) && 962 (fsid_key = exp_get_fsid_key(clp, nxp->ex_dev)) &&
@@ -980,6 +987,9 @@ exp_export(struct nfsctl_export *nxp)
980 987
981 new.h.expiry_time = NEVER; 988 new.h.expiry_time = NEVER;
982 new.h.flags = 0; 989 new.h.flags = 0;
990 new.ex_path = kstrdup(nxp->ex_path, GFP_KERNEL);
991 if (!new.ex_path)
992 goto finish;
983 new.ex_client = clp; 993 new.ex_client = clp;
984 new.ex_mnt = nd.mnt; 994 new.ex_mnt = nd.mnt;
985 new.ex_dentry = nd.dentry; 995 new.ex_dentry = nd.dentry;
@@ -1000,10 +1010,11 @@ exp_export(struct nfsctl_export *nxp)
1000 /* failed to create at least one index */ 1010 /* failed to create at least one index */
1001 exp_do_unexport(exp); 1011 exp_do_unexport(exp);
1002 cache_flush(); 1012 cache_flush();
1003 err = -ENOMEM; 1013 } else
1004 } 1014 err = 0;
1005
1006finish: 1015finish:
1016 if (new.ex_path)
1017 kfree(new.ex_path);
1007 if (exp) 1018 if (exp)
1008 exp_put(exp); 1019 exp_put(exp);
1009 if (fsid_key && !IS_ERR(fsid_key)) 1020 if (fsid_key && !IS_ERR(fsid_key))
@@ -1104,6 +1115,10 @@ exp_rootfh(svc_client *clp, char *path, struct knfsd_fh *f, int maxsize)
1104 path, nd.dentry, clp->name, 1115 path, nd.dentry, clp->name,
1105 inode->i_sb->s_id, inode->i_ino); 1116 inode->i_sb->s_id, inode->i_ino);
1106 exp = exp_parent(clp, nd.mnt, nd.dentry, NULL); 1117 exp = exp_parent(clp, nd.mnt, nd.dentry, NULL);
1118 if (IS_ERR(exp)) {
1119 err = PTR_ERR(exp);
1120 goto out;
1121 }
1107 if (!exp) { 1122 if (!exp) {
1108 dprintk("nfsd: exp_rootfh export not found.\n"); 1123 dprintk("nfsd: exp_rootfh export not found.\n");
1109 goto out; 1124 goto out;
@@ -1159,12 +1174,10 @@ exp_pseudoroot(struct auth_domain *clp, struct svc_fh *fhp,
1159 mk_fsid_v1(fsidv, 0); 1174 mk_fsid_v1(fsidv, 0);
1160 1175
1161 exp = exp_find(clp, 1, fsidv, creq); 1176 exp = exp_find(clp, 1, fsidv, creq);
1162 if (IS_ERR(exp) && PTR_ERR(exp) == -EAGAIN) 1177 if (IS_ERR(exp))
1163 return nfserr_dropit; 1178 return nfserrno(PTR_ERR(exp));
1164 if (exp == NULL) 1179 if (exp == NULL)
1165 return nfserr_perm; 1180 return nfserr_perm;
1166 else if (IS_ERR(exp))
1167 return nfserrno(PTR_ERR(exp));
1168 rv = fh_compose(fhp, exp, exp->ex_dentry, NULL); 1181 rv = fh_compose(fhp, exp, exp->ex_dentry, NULL);
1169 exp_put(exp); 1182 exp_put(exp);
1170 return rv; 1183 return rv;