[PATCH] knfsd : export : Fix bug of svc_export_parse()

Wei Yongjun yjwei at cn.fujitsu.com
Tue Mar 20 05:26:58 EDT 2007


When I export /dev/null as root, and mount it from client, mount ntf4 command will frozen.

You can test it by following command:
#exportfs -i -o fsid=0,no_root_squash,insecure,rw,async *:/dev/null
#mount -t nfs4 127.0.0.1:/ /tmp

This is because in svc_export_parse() function, if check_export return 
false, after we reject the file handle, we must do cleanup the cache, 
which is not a format error of file handle.

Signed-off-by: Wei Yongjun <yjwei at cn.fujitsu.com>

--- fs/nfsd/export.c.orig	2007-02-20 20:59:22.000000000 -0500
+++ fs/nfsd/export.c	2007-03-16 01:04:16.000000000 -0400
@@ -543,12 +543,13 @@ static int svc_export_parse(struct cache
 		if (err) goto out;
 		exp.ex_fsid = an_int;
 
-		err = check_export(nd.dentry->d_inode, exp.ex_flags);
-		if (err) goto out;
-
 		err = fsloc_parse(&mesg, buf, &exp.ex_fslocs);
 		if (err)
 			goto out;
+
+		err = check_export(nd.dentry->d_inode, exp.ex_flags);
+		if (err)
+			set_bit(CACHE_NEGATIVE, &exp.h.flags);
 	}
 
 	expp = svc_export_lookup(&exp);




More information about the NFSv4 mailing list