diff mbox

exportfs: Messages indicating unsupported operation that works

Message ID 20131216183610.GA31816@fieldses.org (mailing list archive)
State New, archived
Headers show

Commit Message

J. Bruce Fields Dec. 16, 2013, 6:36 p.m. UTC
On Sun, Dec 15, 2013 at 09:19:07PM -0600, Tony Asleson wrote:
> When I try to export a directory that has a space in it I get the following:
> 
> # exportfs *:"/mnt/has space"
> exportfs: /mnt/has space does not support NFS export
> 
> exit code is 0.
> 
> If I do:
> 
> # exportfs -v
> /mnt/has space	<world>(ro,wdelay,root_squash,no_subtree_check,
> sec=sys,ro,secure,root_squash,no_all_squash)
> 
> It exists and I can mount it from a client and everything appears fine.
> 
> I took a peek at the code and we are failing in test_export.  We are
> getting a -1 returned when we write to: /proc/net/rpc/nfsd.export/channel .
> 
> This seems like a confusing message when it appears that everything is
> working, thoughts?
> 
> Notes:
> - Kernel Linux rawhide 3.13.0-0.rc3.git1.2.fc21.x86_64
> - nfs-utils: Latest from git, but this happens on older released
> versions tested too.

test_export clearly isn't escaping the pathname.  It probably needs
something like the following (completely untested).

--b.

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
index 4331697..d5dfb0b 100644
--- a/utils/exportfs/exportfs.c
+++ b/utils/exportfs/exportfs.c
@@ -418,11 +418,15 @@  static int can_test(void)
 static int test_export(char *path, int with_fsid)
 {
 	char buf[1024];
+	char *bp = buf;
+	int len = sizeof(buf);
 	int fd, n;
 
-	sprintf(buf, "-test-client- %s 3 %d 65534 65534 0\n",
-		path,
-		with_fsid ? NFSEXP_FSID : 0);
+	n = sprintf(buf, "-test-client- ");
+	bp += n;
+	len -= n;
+	qword_add(&bp, &len, path);
+	sprintf(bp, " 3 %d 65534 65534 0\n", with_fsid ? NFSEXP_FSID : 0);
 	fd = open("/proc/net/rpc/nfsd.export/channel", O_WRONLY);
 	if (fd < 0)
 		return 0;