Commit 5488bb08 authored by Neil Brown's avatar Neil Brown Committed by David S. Miller

[PATCH] kNFSd 8: Don't store path in exports table.

Instead, use d_path to find path from dentry/vfsmnt.
This requires allocating a buffer at exp_open time,
and releasing it when closing.
parent 9c75479d
......@@ -334,7 +334,6 @@ exp_export(struct nfsctl_export *nxp)
goto finish;
dprintk("nfsd: created export entry %p for client %p\n", exp, clp);
strcpy(exp->ex_path, nxp->ex_path);
exp->ex_client = clp;
exp->ex_mnt = mntget(nd.mnt);
exp->ex_dentry = dget(nd.dentry);
......@@ -640,6 +639,7 @@ static int e_show(struct seq_file *m, void *p)
{
struct svc_export *exp = p;
struct svc_client *clp;
char *pbuf;
int j, first = 0;
if (p == (void *)1) {
......@@ -650,7 +650,10 @@ static int e_show(struct seq_file *m, void *p)
clp = exp->ex_client;
mangle(m, exp->ex_path);
pbuf = m->private;
mangle(m, d_path(exp->ex_dentry, exp->ex_mnt,
pbuf, PAGE_SIZE));
seq_putc(m, '\t');
mangle(m, clp->cl_ident);
seq_putc(m, '(');
......
......@@ -127,13 +127,30 @@ static struct file_operations reader_ops = {
extern struct seq_operations nfs_exports_op;
static int exports_open(struct inode *inode, struct file *file)
{
return seq_open(file, &nfs_exports_op);
int res;
res = seq_open(file, &nfs_exports_op);
if (!res) {
char *namebuf = kmalloc(PAGE_SIZE, GFP_KERNEL);
if (namebuf == NULL)
res = -ENOMEM;
else
((struct seq_file *)file->private_data)->private = namebuf;
}
return res;
}
static int exports_release(struct inode *inode, struct file *file)
{
struct seq_file *m = (struct seq_file *)file->private_data;
kfree(m->private);
m->private = NULL;
return seq_release(inode, file);
}
static struct file_operations exports_operations = {
.open = exports_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
.release = exports_release,
};
/*
......
......@@ -62,7 +62,6 @@ struct svc_export {
struct list_head ex_hash;
struct list_head ex_fsid_hash;
struct list_head ex_list;
char ex_path[NFS_MAXPATHLEN+1];
struct svc_client * ex_client;
int ex_flags;
struct vfsmount * ex_mnt;
......
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