Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Jun 2011 01:13:09 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r222663 - head/sys/fs/nfsserver
Message-ID:  <201106040113.p541D9bs087425@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Sat Jun  4 01:13:09 2011
New Revision: 222663
URL: http://svn.freebsd.org/changeset/base/222663

Log:
  Modify the new NFS server so that the NFSv3 Pathconf RPC
  doesn't return an error when the underlying file system
  lacks support for any of the four _PC_xxx values used, by
  falling back to default values.
  
  Tested by:	avg
  MFC after:	2 weeks

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

Modified: head/sys/fs/nfsserver/nfs_nfsdport.c
==============================================================================
--- head/sys/fs/nfsserver/nfs_nfsdport.c	Sat Jun  4 01:11:34 2011	(r222662)
+++ head/sys/fs/nfsserver/nfs_nfsdport.c	Sat Jun  4 01:13:09 2011	(r222663)
@@ -2592,6 +2592,36 @@ nfsvno_pathconf(struct vnode *vp, int fl
 	int error;
 
 	error = VOP_PATHCONF(vp, flag, retf);
+	if (error == EOPNOTSUPP || error == EINVAL) {
+		/*
+		 * Some file systems return EINVAL for name arguments not
+		 * supported and some return EOPNOTSUPP for this case.
+		 * So the NFSv3 Pathconf RPC doesn't fail for these cases,
+		 * just fake them.
+		 */
+		switch (flag) {
+		case _PC_LINK_MAX:
+			*retf = LINK_MAX;
+			break;
+		case _PC_NAME_MAX:
+			*retf = NAME_MAX;
+			break;
+		case _PC_CHOWN_RESTRICTED:
+			*retf = 1;
+			break;
+		case _PC_NO_TRUNC:
+			*retf = 1;
+			break;
+		default:
+			/*
+			 * Only happens if a _PC_xxx is added to the server,
+			 * but this isn't updated.
+			 */
+			*retf = 0;
+			printf("nfsrvd pathconf flag=%d not supp\n", flag);
+		};
+		error = 0;
+	}
 	return (error);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201106040113.p541D9bs087425>