Skip to content

Commit

Permalink
[PATCH] knfsd: Fix up some bit-rot in exp_export
Browse files Browse the repository at this point in the history
The nfsservctl system call 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: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
NeilBrown authored and Linus Torvalds committed Dec 13, 2006
1 parent dd08d6e commit f988443
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions fs/nfsd/export.c
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,8 @@ exp_export(struct nfsctl_export *nxp)

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 */
if ((nxp->ex_flags & NFSEXP_FSID) &&
(fsid_key = exp_get_fsid_key(clp, nxp->ex_dev)) &&
Expand Down Expand Up @@ -985,6 +987,9 @@ exp_export(struct nfsctl_export *nxp)

new.h.expiry_time = NEVER;
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_mnt = nd.mnt;
new.ex_dentry = nd.dentry;
Expand All @@ -1005,10 +1010,11 @@ exp_export(struct nfsctl_export *nxp)
/* failed to create at least one index */
exp_do_unexport(exp);
cache_flush();
err = -ENOMEM;
}

} else
err = 0;
finish:
if (new.ex_path)
kfree(new.ex_path);
if (exp)
exp_put(exp);
if (fsid_key && !IS_ERR(fsid_key))
Expand Down

0 comments on commit f988443

Please sign in to comment.