All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] SGI 900985: fix nohide export option for nfsv3
@ 2003-10-03  3:47 Greg Banks
  2003-10-13  6:17 ` Neil Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Greg Banks @ 2003-10-03  3:47 UTC (permalink / raw)
  To: Neil Brown; +Cc: Linux NFS Mailing List

G'day,

SGI bug 900985.

The "nohide" export option fails over NFSv3 because the client gets
as a side effect of READDIRPLUS file handles for server-side mountpoints 
which haven't gone through the nohide logic in LOOKUP and thus refer
to the underlying directory instead the covering one.

This patch fixes that by changing the XDR encode for the READDIRPLUS
reply to send no file handle if the directory's child is a mountpoint.
The protocol says the filehandle is optional in the READDIRPLUS reply.
If the client has a client-side mountpoint matching the server-side
mountpoint, it will get the file handle of the mountpoint's covering
directory by traversing the client-side mountpoint.  Otherwise, the
client will issue a LOOKUP which will return either the underlying or
covering directories as per the normal nohide logic.

This is on-the-wire identical to how IRIX deals with the issue, as can
be easily demonstrated by sniffing NFS traffic to an IRIX box with a
nohide export.

Tested on Linux 2.4.21 servers with Linux 2.4 and IRIX clients.  The
patch is against 2.4 but the same bug exists in 2.6 and the same patch
should fix it (untested).



--- /usr/tmp/TmpDir.24872-0/linux/linux/fs/nfsd/nfs3xdr.c_1.23	Fri Sep 19 20:12:50
2003
+++ linux/linux/fs/nfsd/nfs3xdr.c	Fri Sep 19 20:09:25 2003
@@ -721,6 +721,8 @@
 			dchild = lookup_one_len(name, dparent,namlen);
 		if (IS_ERR(dchild))
 			goto noexec;
+		if (d_mountpoint(dchild))
+			goto noexec;
 		if (fh_compose(&fh, exp, dchild, cd->dirfh) != 0 || !dchild->d_inode)
 			goto noexec;
 		p = encode_post_op_attr(cd->rqstp, p, &fh);

--- /usr/tmp/TmpDir.24872-0/linux/linux/fs/nfsd/vfs.c_1.47	Fri Sep 19 20:12:50 2003
+++ linux/linux/fs/nfsd/vfs.c	Fri Sep 19 20:08:03 2003
@@ -86,7 +86,7 @@
  * accepted as it stands and the mounted directory is
  * returned. Otherwise the covered directory is returned.
  * NOTE: this mountpoint crossing is not supported properly by all
- *   clients and is explicitly disallowed for NFSv3
+ *   clients.
  *      NeilBrown <neilb@cse.unsw.edu.au>
  */
 int


Greg.
-- 
Greg Banks, R&D Software Engineer, SGI Australian Software Group.
I don't speak for SGI.


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-10-16  2:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-03  3:47 [PATCH] SGI 900985: fix nohide export option for nfsv3 Greg Banks
2003-10-13  6:17 ` Neil Brown
2003-10-13  7:48   ` Greg Banks
2003-10-16  0:40     ` Neil Brown
2003-10-16  2:40       ` Greg Banks

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.