[PATCH 00/13] nfsd patches
Manoj Naik
manoj at almaden.ibm.com
Tue Sep 5 02:41:10 EDT 2006
Neil Brown wrote:
> The fslocations is nearly fine. Just some minor formatting issues in
> the 'exports' file that bother me as I mentioned.
>
> Just to clarify that:
> /proc/fs/nfsd/exports could now have content like:
>
> /path/to/fs hostname(rw,no_root_squash,async,anon_uid=1234,refer=/foo/bar at jupiter:saturn,/home/my files at mars:mercury)
>
> The two issues are:
> - pathnames can have spaces, commas, parentheses etc which need to
> be quoted in in this files, like that "/path/to/fs" name is.
> - you have a comma separated list in a comma separated list, which
> isn't reliably parsable. I would recommend semi-colons.
> so the above would become.
>
> /path/to/fs hostname(rw,no_root_squash,async,anon_uid=1234,refer=/foo/bar at jupiter:saturn;/home/my\040files at mars:mercury)
>
> An incremental patch to fix that would be great if you are happy with
> the different format.
>
How about the attached patch? Only compile-tested so far.
Fred Isaman's nfs-utils patches for fs_locations use the AIX format for
specifying referrals and replicas in exports, which is:
refer=rootpath at host [+host][:rootpath at host [+host]], but I believe the
host string gets translated to host[:host] before being passed down to
the kernel.
Manoj.
-------------- next part --------------
nfsd: fs_locations fixes
From: <>
Add range check for 'migrated' flag and seq_escape 'path' and 'hosts'
fields of locations in export flags.
Signed-off-by: Manoj Naik <manoj at almaden.ibm.com>
---
fs/nfsd/export.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 8d5da7d..02c73bd 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -449,6 +449,9 @@ fsloc_parse(char **mesg, char *buf, stru
err = get_int(mesg, &migrated);
if (err)
goto out_free_all;
+ err = -EINVAL;
+ if (migrated < 0 || migrated > 1)
+ goto out_free_all;
fsloc->migrated = migrated;
return 0;
out_free_all:
@@ -1269,9 +1272,14 @@ static void exp_flags(struct seq_file *m
int i;
seq_printf(m, "%s%s=", first++?",":"", loctype);
- seq_printf(m, "%s@%s", fsloc->locations[0].path, fsloc->locations[0].hosts);
+ seq_escape(m, fsloc->locations[0].path, " \t\n\\");
+ seq_putc(m, '@');
+ seq_escape(m, fsloc->locations[0].hosts, " \t\n\\");
for (i = 1; i < fsloc->locations_count; i++) {
- seq_printf(m, ",%s@%s", fsloc->locations[i].path, fsloc->locations[i].hosts);
+ seq_putc(m, ';');
+ seq_escape(m, fsloc->locations[i].path, " \t\n\\");
+ seq_putc(m, '@');
+ seq_escape(m, fsloc->locations[i].hosts, " \t\n\\");
}
}
}
More information about the NFSv4
mailing list