summaryrefslogtreecommitdiffstats
path: root/sys/fs
diff options
context:
space:
mode:
authorrmacklem <rmacklem@FreeBSD.org>2009-05-27 15:16:56 +0000
committerrmacklem <rmacklem@FreeBSD.org>2009-05-27 15:16:56 +0000
commitc2b3891e90b2c5877c08e34be14e4a4917b4bd0d (patch)
tree1e9be0c8b2127e81af9192d75add2e8f797b26a7 /sys/fs
parent5df7c0e4aeea921da5e686a6b2d482ef9b92dff2 (diff)
downloadFreeBSD-src-c2b3891e90b2c5877c08e34be14e4a4917b4bd0d.zip
FreeBSD-src-c2b3891e90b2c5877c08e34be14e4a4917b4bd0d.tar.gz
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)
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/nfs/nfs_commonport.c22
-rw-r--r--sys/fs/nfs/nfsport.h3
2 files changed, 24 insertions, 1 deletions
diff --git a/sys/fs/nfs/nfs_commonport.c b/sys/fs/nfs/nfs_commonport.c
index 4c17aee..0369113 100644
--- a/sys/fs/nfs/nfs_commonport.c
+++ b/sys/fs/nfs/nfs_commonport.c
@@ -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 *);
/*
diff --git a/sys/fs/nfs/nfsport.h b/sys/fs/nfs/nfsport.h
index 6729bd6..4bbc4f2 100644
--- a/sys/fs/nfs/nfsport.h
+++ b/sys/fs/nfs/nfsport.h
@@ -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
OpenPOWER on IntegriCloud