From e291f14a85473c1a2b9b9f83eb562bda9afe9659 Mon Sep 17 00:00:00 2001
From: Prashanth Pai <ppai@redhat.com>
Date: Tue, 15 Mar 2016 14:21:18 +0530
Subject: [PATCH 59/80] md-cache: Cache gluster-swift metadata
Upstream reference:
>BUG: 1317788
>Change-Id: I86efca6a829cdda70ec7ed7fe0a16b73c25888c3
>Signed-off-by: Prashanth Pai <ppai@redhat.com>
>Reviewed-on: http://review.gluster.org/13753
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
>CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
>Reviewed-by: Niels de Vos <ndevos@redhat.com>
>Smoke: Gluster Build System <jenkins@build.gluster.com>
>Signed-off-by: Prashanth Pai <ppai@redhat.com>
BUG: 1317790
Change-Id: I013e8c0e3960c1cb6a747adae932907fe1051650
Signed-off-by: Prashanth Pai <ppai@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/71234
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Tested-by: Niels de Vos <ndevos@redhat.com>
---
tests/bugs/fuse/bug-1317785.t | 22 ++++++++++++++++++++++
xlators/mgmt/glusterd/src/glusterd-volume-set.c | 8 ++++++++
xlators/performance/md-cache/src/md-cache.c | 22 ++++++++++++++++++++++
3 files changed, 52 insertions(+), 0 deletions(-)
create mode 100644 tests/bugs/fuse/bug-1317785.t
diff --git a/tests/bugs/fuse/bug-1317785.t b/tests/bugs/fuse/bug-1317785.t
new file mode 100644
index 0000000..87c6540
--- /dev/null
+++ b/tests/bugs/fuse/bug-1317785.t
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+
+cleanup;
+
+TEST glusterd
+
+TEST $CLI volume create $V0 $H0:$B0/$V0
+TEST $CLI volume start $V0
+
+TEST $CLI volume set $V0 cache-swift-metadata on
+EXPECT 'on' volinfo_field $V0 'performance.cache-swift-metadata'
+
+TEST $CLI volume set $V0 cache-swift-metadata off
+EXPECT 'off' volinfo_field $V0 'performance.cache-swift-metadata'
+
+TEST $CLI volume stop $V0
+TEST $CLI volume delete $V0
+
+cleanup;
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index 1b68c1b..7bb8f91 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -1393,6 +1393,14 @@ struct volopt_map_entry glusterd_volopt_map[] = {
.op_version = 2,
.flags = OPT_FLAG_CLIENT_OPT
},
+ { .key = "performance.cache-swift-metadata",
+ .voltype = "performance/md-cache",
+ .option = "cache-swift-metadata",
+ .op_version = GD_OP_VERSION_3_7_10,
+ .description = "Cache swift metadata (user.swift.metadata xattr)",
+ .flags = OPT_FLAG_CLIENT_OPT
+ },
+
/* Crypt xlator options */
diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c
index d07e768..b94dade 100644
--- a/xlators/performance/md-cache/src/md-cache.c
+++ b/xlators/performance/md-cache/src/md-cache.c
@@ -36,6 +36,7 @@ struct mdc_conf {
gf_boolean_t cache_posix_acl;
gf_boolean_t cache_selinux;
gf_boolean_t force_readdirp;
+ gf_boolean_t cache_swift_metadata;
};
@@ -69,6 +70,11 @@ static struct mdc_key {
.load = 0,
.check = 1,
},
+ {
+ .name = "user.swift.metadata",
+ .load = 0,
+ .check = 1,
+ },
{
.name = "security.capability",
.load = 0,
@@ -2229,6 +2235,12 @@ reconfigure (xlator_t *this, dict_t *options)
mdc_key_load_set (mdc_keys, "system.posix_acl_", conf->cache_posix_acl);
mdc_key_load_set (mdc_keys, "glusterfs.posix_acl.", conf->cache_posix_acl);
+ GF_OPTION_RECONF ("cache-swift-metadata", conf->cache_swift_metadata,
+ options, bool, out);
+ mdc_key_load_set (mdc_keys, "user.swift.metadata",
+ conf->cache_swift_metadata);
+
+
GF_OPTION_RECONF("force-readdirp", conf->force_readdirp, options, bool, out);
out:
@@ -2265,6 +2277,11 @@ init (xlator_t *this)
mdc_key_load_set (mdc_keys, "system.posix_acl_", conf->cache_posix_acl);
mdc_key_load_set (mdc_keys, "glusterfs.posix_acl.", conf->cache_posix_acl);
+ GF_OPTION_INIT ("cache-swift-metadata",
+ conf->cache_swift_metadata, bool, out);
+ mdc_key_load_set (mdc_keys, "user.swift.metadata",
+ conf->cache_swift_metadata);
+
GF_OPTION_INIT("force-readdirp", conf->force_readdirp, bool, out);
out:
this->private = conf;
@@ -2322,6 +2339,11 @@ struct volume_options options[] = {
.type = GF_OPTION_TYPE_BOOL,
.default_value = "false",
},
+ { .key = {"cache-swift-metadata"},
+ .type = GF_OPTION_TYPE_BOOL,
+ .default_value = "true",
+ .description = "Cache swift metadata (user.swift.metadata xattr)",
+ },
{ .key = {"cache-posix-acl"},
.type = GF_OPTION_TYPE_BOOL,
.default_value = "false",
--
1.7.1