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)
This commit is contained in:
rmacklem 2009-05-27 15:16:56 +00:00
parent 5df7c0e4ae
commit c2b3891e90
2 changed files with 24 additions and 1 deletions

View File

@ -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 *);
/*

View File

@ -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