Author: rmacklem
Date: Sun Jun 19 01:44:50 2011
New Revision: 223284
URL: http://svn.freebsd.org/changeset/base/223284

Log:
  MFC: r222663
  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.

Modified:
  stable/8/sys/fs/nfsserver/nfs_nfsdport.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/fs/nfsserver/nfs_nfsdport.c
==============================================================================
--- stable/8/sys/fs/nfsserver/nfs_nfsdport.c    Sun Jun 19 00:00:36 2011        
(r223283)
+++ stable/8/sys/fs/nfsserver/nfs_nfsdport.c    Sun Jun 19 01:44:50 2011        
(r223284)
@@ -2589,6 +2589,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);
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to