svn commit: r192898 - head/sys/fs/nfs

Rick Macklem rmacklem at FreeBSD.org
Wed May 27 15:16:59 UTC 2009


Author: rmacklem
Date: Wed May 27 15:16:56 2009
New Revision: 192898
URL: http://svn.freebsd.org/changeset/base/192898

Log:
  Add a function to the experimental nfs subsystem that tests to see
  if a local file system supports NFSv4 ACLs. This allows the
  NFSHASNFS4ACL() macro to be correctly implemented. The NFSv4 ACL
  support should now work when the server exports a ZFS volume.
  
  Approved by:	kib (mentor)

Modified:
  head/sys/fs/nfs/nfs_commonport.c
  head/sys/fs/nfs/nfsport.h

Modified: head/sys/fs/nfs/nfs_commonport.c
==============================================================================
--- head/sys/fs/nfs/nfs_commonport.c	Wed May 27 15:15:58 2009	(r192897)
+++ head/sys/fs/nfs/nfs_commonport.c	Wed May 27 15:16:56 2009	(r192898)
@@ -426,6 +426,28 @@ newnfs_portinit(void)
 	mtx_init(&nfs_state_mutex, "nfs_state_mutex", NULL, MTX_DEF);
 }
 
+#ifdef NFS4_ACL_EXTATTR_NAME
+/*
+ * Determine if the file system supports NFSv4 ACLs.
+ * Return 1 if it does, 0 otherwise.
+ */
+int
+nfs_supportsnfsv4acls(struct mount *mp)
+{
+
+	if (mp->mnt_stat.f_fstypename == NULL)
+		return (0);
+	if (strcmp(mp->mnt_stat.f_fstypename, "ufs") == 0) {
+		/* Not yet */
+		return (0);
+	} else if (strcmp(mp->mnt_stat.f_fstypename, "zfs") == 0) {
+		/* Always supports them */
+		return (1);
+	}
+	return (0);
+}
+#endif	/* NFS4_ACL_EXTATTR_NAME */
+
 extern int (*nfsd_call_nfscommon)(struct thread *, struct nfssvc_args *);
 
 /*

Modified: head/sys/fs/nfs/nfsport.h
==============================================================================
--- head/sys/fs/nfs/nfsport.h	Wed May 27 15:15:58 2009	(r192897)
+++ head/sys/fs/nfs/nfsport.h	Wed May 27 15:16:56 2009	(r192898)
@@ -787,7 +787,8 @@ void newnfs_realign(struct mbuf **);
 #define	NFSSETWRITEVERF(n)	((n)->nm_state |= NFSSTA_HASWRITEVERF)
 #define	NFSSETHASSETFSID(n)	((n)->nm_state |= NFSSTA_HASSETFSID)
 #ifdef NFS4_ACL_EXTATTR_NAME
-#define	NFSHASNFS4ACL(m)	0
+#define	NFSHASNFS4ACL(m)	nfs_supportsnfsv4acls(m)
+int nfs_supportsnfsv4acls(struct mount *);
 #else
 #define	NFSHASNFS4ACL(m)	0
 #endif


More information about the svn-src-all mailing list