Commit 92ad857a authored by NeilBrown's avatar NeilBrown Committed by Chris Wright

[PATCH] knfsd: fix up some bit-rot in exp_export

The nfsservctl systemcall isn't used but recent nfs-utils releases for
exporting filesystems, and consequently the code that is uses -
exp_export - has suffered some bitrot.

Particular:
  - some newly added fields in 'struct svc_export' are being initialised
    properly.
  - the return value is now always -ENOMEM ...

This patch fixes both these problems.
Signed-off-by: default avatarNeil Brown <neilb@suse.de>
Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
parent dbd2bd73
...@@ -950,6 +950,8 @@ exp_export(struct nfsctl_export *nxp) ...@@ -950,6 +950,8 @@ exp_export(struct nfsctl_export *nxp)
exp = exp_get_by_name(clp, nd.mnt, nd.dentry, NULL); exp = exp_get_by_name(clp, nd.mnt, nd.dentry, NULL);
memset(&new, 0, sizeof(new));
/* must make sure there won't be an ex_fsid clash */ /* must make sure there won't be an ex_fsid clash */
if ((nxp->ex_flags & NFSEXP_FSID) && if ((nxp->ex_flags & NFSEXP_FSID) &&
(fsid_key = exp_get_fsid_key(clp, nxp->ex_dev)) && (fsid_key = exp_get_fsid_key(clp, nxp->ex_dev)) &&
...@@ -980,6 +982,9 @@ exp_export(struct nfsctl_export *nxp) ...@@ -980,6 +982,9 @@ exp_export(struct nfsctl_export *nxp)
new.h.expiry_time = NEVER; new.h.expiry_time = NEVER;
new.h.flags = 0; new.h.flags = 0;
new.ex_path = kstrdup(nxp->ex_path, GFP_KERNEL);
if (!new.ex_path)
goto finish;
new.ex_client = clp; new.ex_client = clp;
new.ex_mnt = nd.mnt; new.ex_mnt = nd.mnt;
new.ex_dentry = nd.dentry; new.ex_dentry = nd.dentry;
...@@ -1000,10 +1005,11 @@ exp_export(struct nfsctl_export *nxp) ...@@ -1000,10 +1005,11 @@ exp_export(struct nfsctl_export *nxp)
/* failed to create at least one index */ /* failed to create at least one index */
exp_do_unexport(exp); exp_do_unexport(exp);
cache_flush(); cache_flush();
err = -ENOMEM; } else
} err = 0;
finish: finish:
if (new.ex_path)
kfree(new.ex_path);
if (exp) if (exp)
exp_put(exp); exp_put(exp);
if (fsid_key && !IS_ERR(fsid_key)) if (fsid_key && !IS_ERR(fsid_key))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment