diff options
author | Günther Deschner <gd@samba.org> | 2017-07-25 11:54:09 +0200 |
---|---|---|
committer | Jeff Darcy <jeff@pl.atyp.us> | 2017-10-30 15:52:09 +0000 |
commit | ae9b006f23b1408ff548348440369d056becdc1d (patch) | |
tree | e19269b5e0476023be1fe9c8f2927191c0ffad02 /xlators/performance | |
parent | 62dbefde4bc5c8d9dcfb10f3be5d349db341bb30 (diff) |
md-cache: Add additional samba and macOS specific EAs to mdcache
Samba ships with a server implementation of the Apple Create Context
extension (AAPL) as negotiated by all modern Apple clients. With the
support of the AAPL extension, Apple clients will integrate better with
Samba servers. The AAPL implementation itself is contained in the Samba
vfs_fruit(8) module which has to be activated in Samba. This vfs_fruit
module also provides support for macOS alternate data streams which will
be represented in EAs. Two standard data streams ("AFP_AfpInfo" and
"AFP_Resource") will be stored in the following EAs:
* user.org.netatalk.Metadata
* user.org.netatalk.ResourceFork
For all other data streams, vfs_fruit relies on another Samba vfs
module, vfs_streams_xattr(8), to handle these. Although configurable, by
default the vfs_streams_xattr module will build EA keynames with a
"user.DosStream." prefix. Please note that we have to deal with only one
known prefix key, as macOS will happily compose EA keynames like:
* user.DosStream.com.apple.diskimages.fsck:$DATA
* user.DosStream.com.apple.diskimages.recentcksum:$DATA
* user.DosStream.com.apple.metadata:kMDItemWhereFroms:$DATA
* user.DosStream.com.apple.quarantine:$DATA
* etc.
Caching of vfs_fruit specific EAs is crucial for SMB performance and is
controlled with the same configuration option
"performance.cache-samba-metadata".
Guenther
Change-Id: Ia7aa341234dc13e1c0057f3d658b7ef711b5d31e
BUG: 1499933
Signed-off-by: Guenther Deschner <gd@samba.org>
Diffstat (limited to 'xlators/performance')
-rw-r--r-- | xlators/performance/md-cache/src/md-cache.c | 66 |
1 files changed, 60 insertions, 6 deletions
diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c index 8230b6a0762..64a2867f5d9 100644 --- a/xlators/performance/md-cache/src/md-cache.c +++ b/xlators/performance/md-cache/src/md-cache.c @@ -72,56 +72,85 @@ static struct mdc_key { const char *name; int load; int check; + int prefix_match; } mdc_keys[] = { { .name = POSIX_ACL_ACCESS_XATTR, .load = 0, .check = 1, + .prefix_match = 0, }, { .name = POSIX_ACL_DEFAULT_XATTR, .load = 0, .check = 1, + .prefix_match = 0, }, { .name = GF_POSIX_ACL_ACCESS, .load = 0, .check = 1, + .prefix_match = 0, }, { .name = GF_POSIX_ACL_DEFAULT, .load = 0, .check = 1, + .prefix_match = 0, }, { .name = GF_SELINUX_XATTR_KEY, .load = 0, .check = 1, + .prefix_match = 0, }, { .name = "user.swift.metadata", .load = 0, .check = 1, + .prefix_match = 0, }, { .name = "user.DOSATTRIB", .load = 0, .check = 1, + .prefix_match = 0, + }, + { + .name = "user.DosStream.", + .load = 0, + .check = 1, + .prefix_match = 1, + }, + { + .name = "user.org.netatalk.Metadata", + .load = 0, + .check = 1, + .prefix_match = 0, + }, + { + .name = "user.org.netatalk.ResourceFork", + .load = 0, + .check = 1, + .prefix_match = 0, }, { .name = "security.NTACL", .load = 0, .check = 1, + .prefix_match = 0, }, { .name = "security.capability", .load = 0, .check = 1, + .prefix_match = 0, }, { .name = "gfid-req", .load = 0, .check = 1, + .prefix_match = 0, }, { .name = "security.ima", @@ -132,6 +161,7 @@ static struct mdc_key { .name = NULL, .load = 0, .check = 0, + .prefix_match = 0, } }; @@ -606,8 +636,14 @@ updatefn(dict_t *dict, char *key, data_t *value, void *data) for (mdc_key = mdc_keys[i].name; (mdc_key = mdc_keys[i].name); i++) { if (!mdc_keys[i].check) continue; - if (strcmp(mdc_key, key)) - continue; + + if (mdc_keys[i].prefix_match) { + if (strncmp (mdc_key, key, strlen(mdc_key))) + continue; + } else { + if (strcmp(mdc_key, key)) + continue; + } if (!u->dict) { u->dict = dict_new(); @@ -986,8 +1022,13 @@ is_mdc_key_satisfied (const char *key) for (mdc_key = mdc_keys[i].name; (mdc_key = mdc_keys[i].name); i++) { if (!mdc_keys[i].load) continue; - if (strcmp (mdc_key, key) == 0) - return 1; + if (mdc_keys[i].prefix_match) { + if (strncmp (mdc_key, key, strlen(mdc_key)) == 0) + return 1; + } else { + if (strcmp (mdc_key, key) == 0) + return 1; + } } gf_msg_trace ("md-cache", 0, "xattr key %s doesn't satisfy " @@ -2905,6 +2946,12 @@ reconfigure (xlator_t *this, dict_t *options) options, bool, out); mdc_key_load_set (mdc_keys, "user.DOSATTRIB", conf->cache_samba_metadata); + mdc_key_load_set (mdc_keys, "user.DosStream.", + conf->cache_samba_metadata); + mdc_key_load_set (mdc_keys, "user.org.netatalk.Metadata", + conf->cache_samba_metadata); + mdc_key_load_set (mdc_keys, "user.org.netatalk.ResourceFork", + conf->cache_samba_metadata); mdc_key_load_set (mdc_keys, "security.NTACL", conf->cache_samba_metadata); @@ -2979,6 +3026,12 @@ init (xlator_t *this) bool, out); mdc_key_load_set (mdc_keys, "user.DOSATTRIB", conf->cache_samba_metadata); + mdc_key_load_set (mdc_keys, "user.DosStream.", + conf->cache_samba_metadata); + mdc_key_load_set (mdc_keys, "user.org.netatalk.Metadata", + conf->cache_samba_metadata); + mdc_key_load_set (mdc_keys, "user.org.netatalk.ResourceFork", + conf->cache_samba_metadata); mdc_key_load_set (mdc_keys, "security.NTACL", conf->cache_samba_metadata); @@ -3137,8 +3190,9 @@ struct volume_options options[] = { { .key = {"cache-samba-metadata"}, .type = GF_OPTION_TYPE_BOOL, .default_value = "false", - .description = "Cache samba metadata (user.DOSATTRIB, security.NTACL" - " xattrs)", + .description = "Cache samba metadata (user.DOSATTRIB, security.NTACL," + " org.netatalk.Metadata, org.netatalk.ResourceFork, " + "and user.DosStream. xattrs)", }, { .key = {"cache-posix-acl"}, .type = GF_OPTION_TYPE_BOOL, |