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