Mercurial > illumos > nfs4.1
changeset 7757:bf4a45ecb669 onnv_100
PSARC/2008/588 VFSFT_SYSATTR_VIEWS
6739967 New VFSFT needed for sysattr "view" interface (VFSFT_XVATTR currently overloaded)
author | Janice Chang <Janice.Chang@Sun.COM> |
---|---|
date | Tue, 30 Sep 2008 02:00:40 -0400 |
parents | d653ef0c7180 |
children | 23a9e98fb942 |
files | usr/src/uts/common/fs/nfs/nfs4_srv.c usr/src/uts/common/fs/nfs/nfs4_vnops.c usr/src/uts/common/fs/smbclnt/smbfs/smbfs_vnops.c usr/src/uts/common/fs/smbsrv/smb_fsops.c usr/src/uts/common/fs/smbsrv/smb_tree.c usr/src/uts/common/fs/smbsrv/smb_vops.c usr/src/uts/common/fs/tmpfs/tmp_vfsops.c usr/src/uts/common/fs/tmpfs/tmp_vnops.c usr/src/uts/common/fs/ufs/ufs_vfsops.c usr/src/uts/common/fs/ufs/ufs_vnops.c usr/src/uts/common/fs/vfs.c usr/src/uts/common/fs/xattr.c usr/src/uts/common/fs/zfs/zfs_vfsops.c usr/src/uts/common/fs/zfs/zfs_vnops.c usr/src/uts/common/smbsrv/smb_ktypes.h usr/src/uts/common/smbsrv/smb_vops.h usr/src/uts/common/sys/vfs.h usr/src/uts/common/syscall/open.c |
diffstat | 18 files changed, 32 insertions(+), 92 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/common/fs/nfs/nfs4_srv.c Mon Sep 29 18:45:48 2008 -0700 +++ b/usr/src/uts/common/fs/nfs/nfs4_srv.c Tue Sep 30 02:00:40 2008 -0400 @@ -2884,25 +2884,8 @@ goto out; } - /* - * Make a couple of checks made by copen() - * - * Check to make sure underlying fs supports xattrs. This - * is required because solaris filesystem implementations - * (UFS/TMPFS) don't enforce the noxattr mount option - * in VOP_LOOKUP(LOOKUP_XATTR). If fs doesn't support this - * pathconf cmd or if fs supports cmd but doesn't claim - * support for xattr, return NOTSUPP. It would be better - * to use VOP_PATHCONF( _PC_XATTR_ENABLED) for this; however, - * that cmd is not available to VOP_PATHCONF interface - * (it's only implemented inside pathconf syscall)... - * - * Verify permission to put attributes on files (access - * checks from copen). - */ - if ((cs->vp->v_vfsp->vfs_flag & VFS_XATTR) == 0 && - !vfs_has_feature(cs->vp->v_vfsp, VFSFT_XVATTR)) { + !vfs_has_feature(cs->vp->v_vfsp, VFSFT_SYSATTR_VIEWS)) { *cs->statusp = resp->status = puterrno4(ENOTSUP); goto out; }
--- a/usr/src/uts/common/fs/nfs/nfs4_vnops.c Mon Sep 29 18:45:48 2008 -0700 +++ b/usr/src/uts/common/fs/nfs/nfs4_vnops.c Tue Sep 30 02:00:40 2008 -0400 @@ -4968,7 +4968,7 @@ mi = VTOMI4(dvp); if (!(mi->mi_vfsp->vfs_flag & VFS_XATTR) && - !vfs_has_feature(mi->mi_vfsp, VFSFT_XVATTR)) + !vfs_has_feature(mi->mi_vfsp, VFSFT_SYSATTR_VIEWS)) return (EINVAL); drp = VTOR4(dvp);
--- a/usr/src/uts/common/fs/smbclnt/smbfs/smbfs_vnops.c Mon Sep 29 18:45:48 2008 -0700 +++ b/usr/src/uts/common/fs/smbclnt/smbfs/smbfs_vnops.c Tue Sep 30 02:00:40 2008 -0400 @@ -222,14 +222,7 @@ * XXX * When new and relevant functionality is enabled, we should be * calling vfs_set_feature() to inform callers that pieces of - * functionality are available, per PSARC 2007/227, e.g. - * - * VFSFT_XVATTR Supports xvattr for attrs - * VFSFT_CASEINSENSITIVE Supports case-insensitive - * VFSFT_NOCASESENSITIVE NOT case-sensitive - * VFSFT_DIRENTFLAGS Supports dirent flags - * VFSFT_ACLONCREATE Supports ACL on create - * VFSFT_ACEMASKONACCESS Can use ACEMASK for access + * functionality are available, per PSARC 2007/227. */ /* ARGSUSED */ static int
--- a/usr/src/uts/common/fs/smbsrv/smb_fsops.c Mon Sep 29 18:45:48 2008 -0700 +++ b/usr/src/uts/common/fs/smbsrv/smb_fsops.c Tue Sep 30 02:00:40 2008 -0400 @@ -161,7 +161,6 @@ int flags = 0; int rc; boolean_t is_dir; - boolean_t no_xvattr = B_FALSE; ASSERT(fs_sd); @@ -230,12 +229,8 @@ set_attr.sa_mask |= SMB_AT_GID; } - if (set_attr.sa_mask) { - if (smb_tree_has_feature(sr->tid_tree, SMB_TREE_UFS)) - no_xvattr = B_TRUE; - rc = smb_vop_setattr(vp, NULL, &set_attr, 0, kcred, - no_xvattr); - } + if (set_attr.sa_mask) + rc = smb_vop_setattr(vp, NULL, &set_attr, 0, kcred); if (rc == 0) { *ret_snode = smb_node_lookup(sr, &sr->arg.open, cr, vp, @@ -316,7 +311,6 @@ smb_attr_t *ret_attr) { struct open_param *op = &sr->arg.open; - boolean_t no_xvattr = B_FALSE; smb_node_t *fnode; smb_attr_t file_attr; vnode_t *xattrdirvp; @@ -423,9 +417,6 @@ return (rc); } - if (smb_tree_has_feature(sr->tid_tree, SMB_TREE_UFS)) - no_xvattr = B_TRUE; - attr->sa_vattr.va_uid = file_attr.sa_vattr.va_uid; attr->sa_vattr.va_gid = file_attr.sa_vattr.va_gid; attr->sa_mask = SMB_AT_UID | SMB_AT_GID; @@ -438,7 +429,7 @@ * stream) file (see comments for smb_vop_setattr()). */ - rc = smb_vop_setattr(vp, NULL, attr, 0, kcred, no_xvattr); + rc = smb_vop_setattr(vp, NULL, attr, 0, kcred); if (rc != 0) { smb_node_release(fnode); @@ -1270,7 +1261,6 @@ int rc = 0; int flags = 0; uint_t sa_mask; - boolean_t no_xvattr = B_FALSE; ASSERT(cr); ASSERT(snode); @@ -1327,12 +1317,8 @@ ASSERT(unnamed_node->n_state != SMB_NODE_STATE_DESTROYING); unnamed_vp = unnamed_node->vp; } - if (sr && sr->tid_tree) - if (smb_tree_has_feature(sr->tid_tree, SMB_TREE_UFS)) - no_xvattr = B_TRUE; - - rc = smb_vop_setattr(snode->vp, unnamed_vp, set_attr, flags, cr, - no_xvattr); + + rc = smb_vop_setattr(snode->vp, unnamed_vp, set_attr, flags, cr); if ((rc == 0) && ret_attr) { /*
--- a/usr/src/uts/common/fs/smbsrv/smb_tree.c Mon Sep 29 18:45:48 2008 -0700 +++ b/usr/src/uts/common/fs/smbsrv/smb_tree.c Tue Sep 30 02:00:40 2008 -0400 @@ -764,9 +764,6 @@ if (strncasecmp(name, NFS, sizeof (NFS)) == 0) flags |= SMB_TREE_NFS_MOUNTED; - if (strncasecmp(name, "UFS", sizeof ("UFS")) == 0) - flags |= SMB_TREE_UFS; - (void) strlcpy(tree->t_typename, name, SMB_TYPENAMELEN); (void) utf8_strupr((char *)tree->t_typename);
--- a/usr/src/uts/common/fs/smbsrv/smb_vops.c Mon Sep 29 18:45:48 2008 -0700 +++ b/usr/src/uts/common/fs/smbsrv/smb_vops.c Tue Sep 30 02:00:40 2008 -0400 @@ -403,7 +403,7 @@ int smb_vop_setattr(vnode_t *vp, vnode_t *unnamed_vp, smb_attr_t *set_attr, - int flags, cred_t *cr, boolean_t no_xvattr) + int flags, cred_t *cr) { int error = 0; int at_size = 0; @@ -428,8 +428,7 @@ set_attr->sa_vattr.va_mask = 0; - if ((no_xvattr == B_FALSE) && - vfs_has_feature(use_vp->v_vfsp, VFSFT_XVATTR)) { + if (vfs_has_feature(use_vp->v_vfsp, VFSFT_XVATTR)) { smb_vop_setup_xvattr(set_attr, &xvattr); vap = &xvattr.xva_vattr; } else {
--- a/usr/src/uts/common/fs/tmpfs/tmp_vfsops.c Mon Sep 29 18:45:48 2008 -0700 +++ b/usr/src/uts/common/fs/tmpfs/tmp_vfsops.c Tue Sep 30 02:00:40 2008 -0400 @@ -19,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/param.h> #include <sys/sysmacros.h> @@ -372,7 +370,7 @@ out: if (error == 0) - vfs_set_feature(vfsp, VFSFT_XVATTR); + vfs_set_feature(vfsp, VFSFT_SYSATTR_VIEWS); return (error); }
--- a/usr/src/uts/common/fs/tmpfs/tmp_vnops.c Mon Sep 29 18:45:48 2008 -0700 +++ b/usr/src/uts/common/fs/tmpfs/tmp_vnops.c Tue Sep 30 02:00:40 2008 -0400 @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/param.h> #include <sys/t_lock.h> @@ -2381,7 +2379,7 @@ break; case _PC_SATTR_ENABLED: case _PC_SATTR_EXISTS: - *valp = vfs_has_feature(vp->v_vfsp, VFSFT_XVATTR) && + *valp = vfs_has_feature(vp->v_vfsp, VFSFT_SYSATTR_VIEWS) && (vp->v_type == VREG || vp->v_type == VDIR); error = 0; break;
--- a/usr/src/uts/common/fs/ufs/ufs_vfsops.c Mon Sep 29 18:45:48 2008 -0700 +++ b/usr/src/uts/common/fs/ufs/ufs_vfsops.c Tue Sep 30 02:00:40 2008 -0400 @@ -37,8 +37,6 @@ */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/t_lock.h> #include <sys/param.h> @@ -427,7 +425,7 @@ dpn.pn_path, cr, 0, &args, datalen); if (error == 0) { - vfs_set_feature(vfsp, VFSFT_XVATTR); + vfs_set_feature(vfsp, VFSFT_SYSATTR_VIEWS); /* * If lofi, drop our reference to the original file.
--- a/usr/src/uts/common/fs/ufs/ufs_vnops.c Mon Sep 29 18:45:48 2008 -0700 +++ b/usr/src/uts/common/fs/ufs/ufs_vnops.c Tue Sep 30 02:00:40 2008 -0400 @@ -5879,7 +5879,7 @@ case _PC_SATTR_ENABLED: case _PC_SATTR_EXISTS: - *valp = vfs_has_feature(vp->v_vfsp, VFSFT_XVATTR) && + *valp = vfs_has_feature(vp->v_vfsp, VFSFT_SYSATTR_VIEWS) && (vp->v_type == VREG || vp->v_type == VDIR); break;
--- a/usr/src/uts/common/fs/vfs.c Mon Sep 29 18:45:48 2008 -0700 +++ b/usr/src/uts/common/fs/vfs.c Tue Sep 30 02:00:40 2008 -0400 @@ -267,11 +267,11 @@ * some extra bytes that only the sysattr layer knows about. * * This guarantees that sysattr fids are larger than other fids - * for this vfs. If the vfs supports sysattrs (implied - * by VFSFT_XVATTR support), we cannot have a size collision - * with XATTR_FIDSZ. + * for this vfs. If the vfs supports the sysattr view interface + * (as indicated by VFSFT_SYSATTR_VIEWS), we cannot have a size + * collision with XATTR_FIDSZ. */ - if (vfs_has_feature(vfsp, VFSFT_XVATTR) && + if (vfs_has_feature(vfsp, VFSFT_SYSATTR_VIEWS) && fidp->fid_len == XATTR_FIDSZ) return (xattr_dir_vget(vfsp, vpp, fidp));
--- a/usr/src/uts/common/fs/xattr.c Mon Sep 29 18:45:48 2008 -0700 +++ b/usr/src/uts/common/fs/xattr.c Tue Sep 30 02:00:40 2008 -0400 @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/param.h> #include <sys/isa_defs.h> #include <sys/types.h> @@ -465,6 +463,9 @@ xvattr_t xvattr; xoptattr_t *xoap = NULL; /* Pointer to optional attributes */ + if (vfs_has_feature(vp->v_vfsp, VFSFT_XVATTR) == 0) + return (EINVAL); + /* * Validate file offset and size. */
--- a/usr/src/uts/common/fs/zfs/zfs_vfsops.c Mon Sep 29 18:45:48 2008 -0700 +++ b/usr/src/uts/common/fs/zfs/zfs_vfsops.c Tue Sep 30 02:00:40 2008 -0400 @@ -695,6 +695,7 @@ zfsvfs->z_use_fuids = USE_FUIDS(zfsvfs->z_version, zfsvfs->z_os); if (zfsvfs->z_use_fuids) { vfs_set_feature(vfsp, VFSFT_XVATTR); + vfs_set_feature(vfsp, VFSFT_SYSATTR_VIEWS); vfs_set_feature(vfsp, VFSFT_ACEMASKONACCESS); vfs_set_feature(vfsp, VFSFT_ACLONCREATE); }
--- a/usr/src/uts/common/fs/zfs/zfs_vnops.c Mon Sep 29 18:45:48 2008 -0700 +++ b/usr/src/uts/common/fs/zfs/zfs_vnops.c Tue Sep 30 02:00:40 2008 -0400 @@ -1969,12 +1969,12 @@ eodp = (struct edirent *)odp; /* - * If this VFS supports system attributes; and we're looking at an - * extended attribute directory; and we care about normalization - * conflicts on this vfs; then we must check for normalization - * conflicts with the sysattr name space. + * If this VFS supports the system attribute view interface; and + * we're looking at an extended attribute directory; and we care + * about normalization conflicts on this vfs; then we must check + * for normalization conflicts with the sysattr name space. */ - check_sysattrs = vfs_has_feature(vp->v_vfsp, VFSFT_XVATTR) && + check_sysattrs = vfs_has_feature(vp->v_vfsp, VFSFT_SYSATTR_VIEWS) && (vp->v_flag & V_XATTRDIR) && zfsvfs->z_norm && (flags & V_RDDIR_ENTFLAGS); @@ -4387,7 +4387,7 @@ case _PC_SATTR_ENABLED: case _PC_SATTR_EXISTS: - *valp = vfs_has_feature(vp->v_vfsp, VFSFT_XVATTR) && + *valp = vfs_has_feature(vp->v_vfsp, VFSFT_SYSATTR_VIEWS) && (vp->v_type == VREG || vp->v_type == VDIR); return (0);
--- a/usr/src/uts/common/smbsrv/smb_ktypes.h Mon Sep 29 18:45:48 2008 -0700 +++ b/usr/src/uts/common/smbsrv/smb_ktypes.h Tue Sep 30 02:00:40 2008 -0400 @@ -777,16 +777,6 @@ #define SMB_TREE_ACEMASKONACCESS 0x00000800 #define SMB_TREE_NFS_MOUNTED 0x00001000 -/* - * Currently, the VFSFT_XVATTR feature is defined for file systems - * which understand the xvattr_t interface as well as for file systems - * which do not, but which understand the system attribute "view" interface. - * Since we need to be able to differentiate between these two for UFS, - * for now we use SMB_TREE_UFS so that we do the right thing. - */ - -#define SMB_TREE_UFS 0x00002000 - typedef enum { SMB_TREE_STATE_CONNECTED = 0, SMB_TREE_STATE_DISCONNECTING,
--- a/usr/src/uts/common/smbsrv/smb_vops.h Mon Sep 29 18:45:48 2008 -0700 +++ b/usr/src/uts/common/smbsrv/smb_vops.h Tue Sep 30 02:00:40 2008 -0400 @@ -188,8 +188,7 @@ int smb_vop_read(vnode_t *, uio_t *, cred_t *); int smb_vop_write(vnode_t *, uio_t *, int, uint32_t *, cred_t *); int smb_vop_getattr(vnode_t *, vnode_t *, smb_attr_t *, int, cred_t *); -int smb_vop_setattr(vnode_t *, vnode_t *, smb_attr_t *, int, cred_t *, - boolean_t); +int smb_vop_setattr(vnode_t *, vnode_t *, smb_attr_t *, int, cred_t *); int smb_vop_access(vnode_t *, int, int, vnode_t *, cred_t *); void smb_vop_eaccess(vnode_t *, int *, int, vnode_t *, cred_t *); int smb_vop_lookup(vnode_t *, char *, vnode_t **, char *, int, vnode_t *,
--- a/usr/src/uts/common/sys/vfs.h Mon Sep 29 18:45:48 2008 -0700 +++ b/usr/src/uts/common/sys/vfs.h Tue Sep 30 02:00:40 2008 -0400 @@ -34,8 +34,6 @@ #ifndef _SYS_VFS_H #define _SYS_VFS_H -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/types.h> #include <sys/t_lock.h> #include <sys/cred.h> @@ -297,6 +295,7 @@ #define VFSFT_DIRENTFLAGS 0x100000008 /* Supports dirent flags */ #define VFSFT_ACLONCREATE 0x100000010 /* Supports ACL on create */ #define VFSFT_ACEMASKONACCESS 0x100000020 /* Can use ACEMASK for access */ +#define VFSFT_SYSATTR_VIEWS 0x100000040 /* Supports sysattr view i/f */ /* * Argument structure for mount(2).
--- a/usr/src/uts/common/syscall/open.c Mon Sep 29 18:45:48 2008 -0700 +++ b/usr/src/uts/common/syscall/open.c Tue Sep 30 02:00:40 2008 -0400 @@ -31,8 +31,6 @@ * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <sys/param.h> #include <sys/isa_defs.h> #include <sys/types.h> @@ -155,7 +153,7 @@ } if ((startvp->v_vfsp->vfs_flag & VFS_XATTR) != 0 || - vfs_has_feature(startvp->v_vfsp, VFSFT_XVATTR)) { + vfs_has_feature(startvp->v_vfsp, VFSFT_SYSATTR_VIEWS)) { error = VOP_LOOKUP(startvp, "", &sdvp, &pn, (filemode & FXATTRDIROPEN) ? LOOKUP_XATTR : LOOKUP_XATTR|CREATE_XATTR_DIR, rootvp, CRED(),