summaryrefslogtreecommitdiffstats
path: root/sys/fs/nfs
diff options
context:
space:
mode:
authorrmacklem <rmacklem@FreeBSD.org>2011-04-14 23:46:15 +0000
committerrmacklem <rmacklem@FreeBSD.org>2011-04-14 23:46:15 +0000
commit42cdb57de6abf64c210a8803e255316b862633a8 (patch)
treee5f9c4eded45dce4197320c137ba3aaab730b04e /sys/fs/nfs
parent5e701afcf0ad5097517625cc499c5575008471a4 (diff)
downloadFreeBSD-src-42cdb57de6abf64c210a8803e255316b862633a8.zip
FreeBSD-src-42cdb57de6abf64c210a8803e255316b862633a8.tar.gz
Fix the experimental NFSv4 server so that it uses VOP_PATHCONF()
to determine if a file system supports NFSv4 ACLs. Since VOP_PATHCONF() must be called with a locked vnode, the function is called before nfsvno_fillattr() and the result is passed in as an extra argument. MFC after: 2 weeks
Diffstat (limited to 'sys/fs/nfs')
-rw-r--r--sys/fs/nfs/nfs_commonacl.c2
-rw-r--r--sys/fs/nfs/nfs_commonport.c16
-rw-r--r--sys/fs/nfs/nfs_commonsubs.c8
-rw-r--r--sys/fs/nfs/nfs_var.h5
-rw-r--r--sys/fs/nfs/nfsport.h6
5 files changed, 16 insertions, 21 deletions
diff --git a/sys/fs/nfs/nfs_commonacl.c b/sys/fs/nfs/nfs_commonacl.c
index 910a6a4..c4875d8 100644
--- a/sys/fs/nfs/nfs_commonacl.c
+++ b/sys/fs/nfs/nfs_commonacl.c
@@ -445,7 +445,7 @@ nfsrv_setacl(vnode_t vp, NFSACL_T *aclp, struct ucred *cred,
{
int error;
- if (nfsrv_useacl == 0 || !NFSHASNFS4ACL(vnode_mount(vp)))
+ if (nfsrv_useacl == 0 || nfs_supportsnfsv4acls(vp) == 0)
return (NFSERR_ATTRNOTSUPP);
/*
* With NFSv4 ACLs, chmod(2) may need to add additional entries.
diff --git a/sys/fs/nfs/nfs_commonport.c b/sys/fs/nfs/nfs_commonport.c
index c747ff0..4ea5dd4 100644
--- a/sys/fs/nfs/nfs_commonport.c
+++ b/sys/fs/nfs/nfs_commonport.c
@@ -437,18 +437,18 @@ newnfs_portinit(void)
* Return 1 if it does, 0 otherwise.
*/
int
-nfs_supportsnfsv4acls(struct mount *mp)
+nfs_supportsnfsv4acls(struct vnode *vp)
{
+ int error;
+ register_t retval;
- if (mp->mnt_stat.f_fstypename == NULL)
- return (0);
- if (strcmp(mp->mnt_stat.f_fstypename, "ufs") == 0) {
- /* Not yet */
+ ASSERT_VOP_LOCKED(vp, "nfs supports nfsv4acls");
+
+ if (nfsrv_useacl == 0)
return (0);
- } else if (strcmp(mp->mnt_stat.f_fstypename, "zfs") == 0) {
- /* Always supports them */
+ error = VOP_PATHCONF(vp, _PC_ACL_NFS4, &retval);
+ if (error == 0 && retval != 0)
return (1);
- }
return (0);
}
diff --git a/sys/fs/nfs/nfs_commonsubs.c b/sys/fs/nfs/nfs_commonsubs.c
index 5cdb968..e725889 100644
--- a/sys/fs/nfs/nfs_commonsubs.c
+++ b/sys/fs/nfs/nfs_commonsubs.c
@@ -1919,7 +1919,7 @@ APPLESTATIC int
nfsv4_fillattr(struct nfsrv_descript *nd, struct mount *mp, vnode_t vp,
NFSACL_T *saclp, struct vattr *vap, fhandle_t *fhp, int rderror,
nfsattrbit_t *attrbitp, struct ucred *cred, NFSPROC_T *p, int isdgram,
- int reterr, int at_root, uint64_t mounted_on_fileno)
+ int reterr, int supports_nfsv4acls, int at_root, uint64_t mounted_on_fileno)
{
int bitpos, retnum = 0;
u_int32_t *tl;
@@ -1974,12 +1974,12 @@ nfsv4_fillattr(struct nfsrv_descript *nd, struct mount *mp, vnode_t vp,
*/
if (NFSISSET_ATTRBIT(retbitp, NFSATTRBIT_ACLSUPPORT) &&
(nfsrv_useacl == 0 || ((cred != NULL || p != NULL) &&
- !NFSHASNFS4ACL(mp)))) {
+ supports_nfsv4acls == 0))) {
NFSCLRBIT_ATTRBIT(retbitp, NFSATTRBIT_ACLSUPPORT);
}
if (NFSISSET_ATTRBIT(retbitp, NFSATTRBIT_ACL)) {
if (nfsrv_useacl == 0 || ((cred != NULL || p != NULL) &&
- !NFSHASNFS4ACL(mp))) {
+ supports_nfsv4acls == 0)) {
NFSCLRBIT_ATTRBIT(retbitp, NFSATTRBIT_ACL);
} else if (naclp != NULL) {
if (vn_lock(vp, LK_SHARED) == 0) {
@@ -2016,7 +2016,7 @@ nfsv4_fillattr(struct nfsrv_descript *nd, struct mount *mp, vnode_t vp,
case NFSATTRBIT_SUPPORTEDATTRS:
NFSSETSUPP_ATTRBIT(&attrbits);
if (nfsrv_useacl == 0 || ((cred != NULL || p != NULL)
- && !NFSHASNFS4ACL(mp))) {
+ && supports_nfsv4acls == 0)) {
NFSCLRBIT_ATTRBIT(&attrbits,NFSATTRBIT_ACLSUPPORT);
NFSCLRBIT_ATTRBIT(&attrbits,NFSATTRBIT_ACL);
}
diff --git a/sys/fs/nfs/nfs_var.h b/sys/fs/nfs/nfs_var.h
index 8a1c79f..0f8186c 100644
--- a/sys/fs/nfs/nfs_var.h
+++ b/sys/fs/nfs/nfs_var.h
@@ -290,7 +290,7 @@ void nfsrv_wcc(struct nfsrv_descript *, int, struct nfsvattr *, int,
struct nfsvattr *);
int nfsv4_fillattr(struct nfsrv_descript *, struct mount *, vnode_t, NFSACL_T *,
struct vattr *, fhandle_t *, int, nfsattrbit_t *,
- struct ucred *, NFSPROC_T *, int, int, int, uint64_t);
+ struct ucred *, NFSPROC_T *, int, int, int, int, uint64_t);
void nfsrv_fillattr(struct nfsrv_descript *, struct nfsvattr *);
void nfsrv_adj(mbuf_t, int, int);
void nfsrv_postopattr(struct nfsrv_descript *, int, struct nfsvattr *);
@@ -328,6 +328,7 @@ int nfs_catnap(int, int, const char *);
struct nfsreferral *nfsv4root_getreferral(vnode_t, vnode_t, u_int32_t);
int nfsrv_atroot(vnode_t, long *);
void newnfs_timer(void *);
+int nfs_supportsnfsv4acls(vnode_t);
/* nfs_commonacl.c */
int nfsrv_dissectace(struct nfsrv_descript *, struct acl_entry *,
@@ -558,7 +559,7 @@ void nfsvno_updfilerev(vnode_t, struct nfsvattr *, struct ucred *,
NFSPROC_T *);
int nfsvno_fillattr(struct nfsrv_descript *, struct mount *, vnode_t,
struct nfsvattr *, fhandle_t *, int, nfsattrbit_t *,
- struct ucred *, NFSPROC_T *, int, int, int, uint64_t);
+ struct ucred *, NFSPROC_T *, int, int, int, int, uint64_t);
int nfsrv_sattr(struct nfsrv_descript *, struct nfsvattr *, nfsattrbit_t *,
NFSACL_T *, NFSPROC_T *);
int nfsv4_sattr(struct nfsrv_descript *, struct nfsvattr *, nfsattrbit_t *,
diff --git a/sys/fs/nfs/nfsport.h b/sys/fs/nfs/nfsport.h
index d008a46..f061089 100644
--- a/sys/fs/nfs/nfsport.h
+++ b/sys/fs/nfs/nfsport.h
@@ -778,12 +778,6 @@ void newnfs_realign(struct mbuf **);
#define NFSHASPRIVACY(n) ((n)->nm_flag & NFSMNT_PRIVACY)
#define NFSSETWRITEVERF(n) ((n)->nm_state |= NFSSTA_HASWRITEVERF)
#define NFSSETHASSETFSID(n) ((n)->nm_state |= NFSSTA_HASSETFSID)
-#ifdef NFS4_ACL_EXTATTR_NAME
-#define NFSHASNFS4ACL(m) nfs_supportsnfsv4acls(m)
-int nfs_supportsnfsv4acls(struct mount *);
-#else
-#define NFSHASNFS4ACL(m) 0
-#endif
/*
* Gets the stats field out of the mount structure.
OpenPOWER on IntegriCloud