[PATCH] Storing the ACL control flags with vfs gpfs.

Christof Schmitt cs at samba.org
Wed Mar 19 16:10:34 MDT 2014


On Mon, Mar 17, 2014 at 03:02:10PM +0100, Alexander Werth wrote:
> I forgot the signed-off-by and added some text to the commit message.
> 
> Please comment/push.

I think the overall approach is good, and avoiding the GPFS 3.5 defines
does not make the code too ugly. Some comments:

0001-vfs-Support-NFS-control-flags-in-nfs4_acls.c.patch

--- a/source3/modules/nfs4_acls.c
+++ b/source3/modules/nfs4_acls.c
@@ -49,6 +49,7 @@ typedef struct _SMB_ACE4_INT_T
 typedef struct _SMB_ACL4_INT_T
 {
 	uint32	magic;
+	uint16  controlflags;
 	uint32	naces;
 	SMB_ACE4_INT_T	*first;
 	SMB_ACE4_INT_T	*last;

Should we use uint16_t throughout these patches to move the code towards
the C99 types? It is different from the existing code in the file, but
changing it has to start at some point.

0002-vfs-Store-ACL-control-flags-in-gpfs-vfs-module.patch

--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
...
@@ -207,6 +225,34 @@ static int vfs_gpfs_get_real_filename(struct
vfs_handle_struct *handle,
 	return 0;
 }
 
+static void sd2gpfs_control(uint16_t control, struct gpfs_acl *gacl)
+{
+	unsigned int gpfs_aclflags = 0;
+	gpfs_aclflags = control << 8;
+	gpfs_aclflags &= 0x3c3c00; /* ACL4_FLAG_DACL_PROTECTED |
+				      ACL4_FLAG_SACL_PROTECTED |
+				      ACL4_FLAG_DACL_AUTO_INHERITED |
+				      ACL4_FLAG_SACL_AUTO_INHERITED |
+				      ACL4_FLAG_DACL_DEFAULTED |
+				      ACL4_FLAG_SACL_DEFAULTED |
+				      ACL4_FLAG_DACL_PRESENT |
+				      ACL4_FLAG_SACL_PRESENT; */
+	if (!(control & 0x00000400)) /* SEC_DESC_DACL_PRESENT */
+		gpfs_aclflags |= 0x00800000; /* ACL4_FLAG_NULL_DACL; */
+	if (!(control & 0x00001000)) /* SEC_DESC_SACL_PRESENT */
+		gpfs_aclflags |= 0x01000000; /* ACL4_FLAG_NULL_SACL; */

The if statements should use braces. Also the SEC_DESC_... defines are
from Samba, not GPFS, so they can be used without problems.

+	gacl->acl_level = 1; /* GPFS_ACL_LEVEL_V4FLAGS*/
+	/* gacl->v4Level1.acl_flags requires gpfs 3.5 */
+	*(unsigned int *)&gacl->ace_v4 = gpfs_aclflags;
+}
+
+static uint16_t gpfs2sd_control(unsigned int gpfs_aclflags)
+{
+	uint16_t control = gpfs_aclflags >> 8;
+	control |= SEC_DESC_SELF_RELATIVE;
+	return control;
+}

It is probably unlikely that someone would be modifying the flags in the
filesystem without going through Samba, but should gpfs2sd_control use
the same mask as sd2gpfs_control for consistency? Maybe create a
static uint16_t gpfs_aclflags_mask = 0x3c3c00; and use it in both
functions?

Also the ACL4_FLAG_NULL_DACL and ACL4_FLAG_NULL_SACL mappings are
missing from gpfs2sd_control. Are they not needed here?

Regards,

Christof


More information about the samba-technical mailing list