svn commit: r225049 - head/sys/fs/nfsserver

Rick Macklem rmacklem at FreeBSD.org
Sat Aug 20 21:26:35 UTC 2011


Author: rmacklem
Date: Sat Aug 20 21:26:35 2011
New Revision: 225049
URL: http://svn.freebsd.org/changeset/base/225049

Log:
  Fix the NFSv4 server so that it returns NFSERR_SYMLINK when
  an attempt to do an Open operation on any type of file other
  than VREG is done. A recent discussion on the IETF working group's
  mailing list (nfsv4 at ietf.org) decided that NFSERR_SYMLINK
  should be returned for all non-regular files and not just symlinks,
  so that the Linux client would work correctly.
  This change does not affect the FreeBSD NFSv4 client and is not
  believed to have a negative effect on other NFSv4 clients.
  
  Reviewed by:	zkirsch
  Approved by:	re (kib)
  MFC after:	2 weeks

Modified:
  head/sys/fs/nfsserver/nfs_nfsdserv.c

Modified: head/sys/fs/nfsserver/nfs_nfsdserv.c
==============================================================================
--- head/sys/fs/nfsserver/nfs_nfsdserv.c	Sat Aug 20 19:21:46 2011	(r225048)
+++ head/sys/fs/nfsserver/nfs_nfsdserv.c	Sat Aug 20 21:26:35 2011	(r225049)
@@ -2741,12 +2741,11 @@ nfsrvd_open(struct nfsrv_descript *nd, _
 	 * Do basic access checking.
 	 */
 	if (!nd->nd_repstat && vnode_vtype(vp) != VREG) {
-	    if (vnode_vtype(vp) == VDIR)
-		nd->nd_repstat = NFSERR_ISDIR;
-	    else if (vnode_vtype(vp) == VLNK)
+		/*
+		 * The IETF working group decided that this is the correct
+		 * error return for all non-regular files.
+		 */
 		nd->nd_repstat = NFSERR_SYMLINK;
-	    else
-		nd->nd_repstat = NFSERR_INVAL;
 	}
 	if (!nd->nd_repstat && (stp->ls_flags & NFSLCK_WRITEACCESS))
 	    nd->nd_repstat = nfsvno_accchk(vp, VWRITE, nd->nd_cred,


More information about the svn-src-all mailing list