Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 May 2009 15:16:56 +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: r192898 - head/sys/fs/nfs
Message-ID:  <200905271516.n4RFGu2A000994@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



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