3604df
From 9c7dd4adcc6d242eef75902dd0777320812ab574 Mon Sep 17 00:00:00 2001
3604df
From: Poornima G <pgurusid@redhat.com>
3604df
Date: Wed, 29 Jun 2016 00:25:39 -0400
3604df
Subject: [PATCH 113/141] md-cache: Cache gluster-samba metadata
3604df
3604df
Change-Id: I0a95f4897440c5bf6f54612d9c232e015c8bf983
3604df
BUG: 1284873
3604df
Signed-off-by: Poornima G <pgurusid@redhat.com>
3604df
Reviewed-on: http://review.gluster.org/14824
3604df
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
3604df
Reviewed-by: Prashanth Pai <ppai@redhat.com>
3604df
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
3604df
Smoke: Gluster Build System <jenkins@build.gluster.org>
3604df
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
3604df
Reviewed-on: https://code.engineering.redhat.com/gerrit/87026
3604df
Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
3604df
Tested-by: Rajesh Joseph <rjoseph@redhat.com>
3604df
---
3604df
 tests/bugs/md-cache/bug-1211863.t               |   22 ++++++++++++++++
3604df
 xlators/mgmt/glusterd/src/glusterd-volume-set.c |    9 ++++++-
3604df
 xlators/performance/md-cache/src/md-cache.c     |   30 +++++++++++++++++++++++
3604df
 3 files changed, 60 insertions(+), 1 deletions(-)
3604df
 create mode 100644 tests/bugs/md-cache/bug-1211863.t
3604df
3604df
diff --git a/tests/bugs/md-cache/bug-1211863.t b/tests/bugs/md-cache/bug-1211863.t
3604df
new file mode 100644
3604df
index 0000000..b969fbb
3604df
--- /dev/null
3604df
+++ b/tests/bugs/md-cache/bug-1211863.t
3604df
@@ -0,0 +1,22 @@
3604df
+#!/bin/bash
3604df
+
3604df
+. $(dirname $0)/../../include.rc
3604df
+. $(dirname $0)/../../volume.rc
3604df
+
3604df
+cleanup;
3604df
+
3604df
+TEST glusterd
3604df
+
3604df
+TEST $CLI volume create $V0 $H0:$B0/$V0
3604df
+TEST $CLI volume start $V0
3604df
+
3604df
+TEST $CLI volume set $V0 cache-samba-metadata on
3604df
+EXPECT 'on' volinfo_field $V0 'performance.cache-samba-metadata'
3604df
+
3604df
+TEST $CLI volume set $V0 cache-samba-metadata off
3604df
+EXPECT 'off' volinfo_field $V0 'performance.cache-samba-metadata'
3604df
+
3604df
+TEST $CLI volume stop $V0
3604df
+TEST $CLI volume delete $V0
3604df
+
3604df
+cleanup;
3604df
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
3604df
index 8978709..100e032 100644
3604df
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
3604df
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
3604df
@@ -1586,7 +1586,14 @@ struct volopt_map_entry glusterd_volopt_map[] = {
3604df
           .description = "Cache swift metadata (user.swift.metadata xattr)",
3604df
           .flags      = OPT_FLAG_CLIENT_OPT
3604df
         },
3604df
-
3604df
+        { .key        = "performance.cache-samba-metadata",
3604df
+          .voltype    = "performance/md-cache",
3604df
+          .option     = "cache-samba-metadata",
3604df
+          .op_version = GD_OP_VERSION_3_9_0,
3604df
+          .description = "Cache samba metadata (user.DOSATTRIB, security.NTACL"
3604df
+                         " xattr)",
3604df
+          .flags      = OPT_FLAG_CLIENT_OPT
3604df
+        },
3604df
 
3604df
  	/* Crypt xlator options */
3604df
 
3604df
diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c
3604df
index 31bc8d8..c1aef21 100644
3604df
--- a/xlators/performance/md-cache/src/md-cache.c
3604df
+++ b/xlators/performance/md-cache/src/md-cache.c
3604df
@@ -33,6 +33,7 @@ struct mdc_conf {
3604df
 	gf_boolean_t cache_selinux;
3604df
 	gf_boolean_t force_readdirp;
3604df
         gf_boolean_t cache_swift_metadata;
3604df
+        gf_boolean_t cache_samba_metadata;
3604df
 };
3604df
 
3604df
 
3604df
@@ -71,6 +72,16 @@ static struct mdc_key {
3604df
                 .load = 0,
3604df
                 .check = 1,
3604df
         },
3604df
+        {
3604df
+                .name = "user.DOSATTRIB",
3604df
+                .load = 0,
3604df
+                .check = 1,
3604df
+        },
3604df
+        {
3604df
+                .name = "security.NTACL",
3604df
+                .load = 0,
3604df
+                .check = 1,
3604df
+        },
3604df
 	{
3604df
 		.name = "security.capability",
3604df
 		.load = 0,
3604df
@@ -2314,6 +2325,12 @@ reconfigure (xlator_t *this, dict_t *options)
3604df
         mdc_key_load_set (mdc_keys, "user.swift.metadata",
3604df
                           conf->cache_swift_metadata);
3604df
 
3604df
+        GF_OPTION_RECONF ("cache-samba-metadata", conf->cache_samba_metadata,
3604df
+                          options, bool, out);
3604df
+        mdc_key_load_set (mdc_keys, "user.DOSATTRIB",
3604df
+                          conf->cache_samba_metadata);
3604df
+        mdc_key_load_set (mdc_keys, "security.NTACL",
3604df
+                          conf->cache_samba_metadata);
3604df
 
3604df
 	GF_OPTION_RECONF("force-readdirp", conf->force_readdirp, options, bool, out);
3604df
 
3604df
@@ -2356,6 +2373,13 @@ init (xlator_t *this)
3604df
         mdc_key_load_set (mdc_keys, "user.swift.metadata",
3604df
                           conf->cache_swift_metadata);
3604df
 
3604df
+        GF_OPTION_INIT ("cache-samba-metadata", conf->cache_samba_metadata,
3604df
+                        bool, out);
3604df
+        mdc_key_load_set (mdc_keys, "user.DOSATTRIB",
3604df
+                          conf->cache_samba_metadata);
3604df
+        mdc_key_load_set (mdc_keys, "security.NTACL",
3604df
+                          conf->cache_samba_metadata);
3604df
+
3604df
 	GF_OPTION_INIT("force-readdirp", conf->force_readdirp, bool, out);
3604df
 out:
3604df
 	this->private = conf;
3604df
@@ -2419,6 +2443,12 @@ struct volume_options options[] = {
3604df
           .default_value = "true",
3604df
           .description = "Cache swift metadata (user.swift.metadata xattr)",
3604df
         },
3604df
+        { .key = {"cache-samba-metadata"},
3604df
+          .type = GF_OPTION_TYPE_BOOL,
3604df
+          .default_value = "false",
3604df
+          .description = "Cache samba metadata (user.DOSATTRIB, security.NTACL"
3604df
+                         " xattrs)",
3604df
+        },
3604df
 	{ .key = {"cache-posix-acl"},
3604df
 	  .type = GF_OPTION_TYPE_BOOL,
3604df
 	  .default_value = "false",
3604df
-- 
3604df
1.7.1
3604df