changeset 8547:bcc7b46e5ff7

6792884 Vista clients cannot access .zfs
author Mark Shellenbaum <Mark.Shellenbaum@Sun.COM>
date Wed, 14 Jan 2009 09:41:17 -0700
parents 218ed9bce280
children a55d544e54ba
files usr/src/uts/common/fs/zfs/zfs_ctldir.c usr/src/uts/common/sys/acl.h
diffstat 2 files changed, 30 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/fs/zfs/zfs_ctldir.c	Wed Jan 14 06:44:41 2009 -0800
+++ b/usr/src/uts/common/fs/zfs/zfs_ctldir.c	Wed Jan 14 09:41:17 2009 -0700
@@ -19,12 +19,10 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 /*
  * ZFS control directory (a.k.a. ".zfs")
  *
@@ -275,8 +273,13 @@
 zfsctl_common_access(vnode_t *vp, int mode, int flags, cred_t *cr,
     caller_context_t *ct)
 {
-	if (mode & VWRITE)
-		return (EACCES);
+	if (flags & V_ACE_MASK) {
+		if (mode & ACE_ALL_WRITE_PERMS)
+			return (EACCES);
+	} else {
+		if (mode & VWRITE)
+			return (EACCES);
+	}
 
 	return (0);
 }
@@ -411,6 +414,22 @@
 	return (err);
 }
 
+static int
+zfsctl_pathconf(vnode_t *vp, int cmd, ulong_t *valp, cred_t *cr,
+    caller_context_t *ct)
+{
+	/*
+	 * We only care about ACL_ENABLED so that libsec can
+	 * display ACL correctly and not default to POSIX draft.
+	 */
+	if (cmd == _PC_ACL_ENABLED) {
+		*valp = _ACL_ACE_ENABLED;
+		return (0);
+	}
+
+	return (fs_pathconf(vp, cmd, valp, cr, ct));
+}
+
 static const fs_operation_def_t zfsctl_tops_root[] = {
 	{ VOPNAME_OPEN,		{ .vop_open = zfsctl_common_open }	},
 	{ VOPNAME_CLOSE,	{ .vop_close = zfsctl_common_close }	},
@@ -421,6 +440,7 @@
 	{ VOPNAME_LOOKUP,	{ .vop_lookup = zfsctl_root_lookup }	},
 	{ VOPNAME_SEEK,		{ .vop_seek = fs_seek }			},
 	{ VOPNAME_INACTIVE,	{ .vop_inactive = gfs_vop_inactive }	},
+	{ VOPNAME_PATHCONF,	{ .vop_pathconf = zfsctl_pathconf }	},
 	{ VOPNAME_FID,		{ .vop_fid = zfsctl_common_fid	}	},
 	{ NULL }
 };
--- a/usr/src/uts/common/sys/acl.h	Wed Jan 14 06:44:41 2009 -0800
+++ b/usr/src/uts/common/sys/acl.h	Wed Jan 14 09:41:17 2009 -0700
@@ -19,15 +19,13 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
 #ifndef _SYS_ACL_H
 #define	_SYS_ACL_H
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #include <sys/types.h>
 #include <sys/acl_impl.h>
 
@@ -156,6 +154,10 @@
     ACE_WRITE_ATTRIBUTES|ACE_DELETE|ACE_READ_ACL|ACE_WRITE_ACL| \
     ACE_WRITE_OWNER|ACE_SYNCHRONIZE)
 
+#define	ACE_ALL_WRITE_PERMS (ACE_WRITE_DATA|ACE_APPEND_DATA| \
+    ACE_WRITE_ATTRIBUTES|ACE_WRITE_NAMED_ATTRS|ACE_WRITE_ACL| \
+    ACE_WRITE_OWNER|ACE_DELETE|ACE_DELETE_CHILD)
+
 #define	ACE_READ_PERMS	(ACE_READ_DATA|ACE_READ_ACL|ACE_READ_ATTRIBUTES| \
     ACE_READ_NAMED_ATTRS)