From 44dbec60a2cd8fe6a68ff30cb6b8a1cf67b717be Mon Sep 17 00:00:00 2001 From: Ravishankar N Date: Tue, 27 Sep 2016 10:39:58 +0530 Subject: afr: Ignore gluster internal (virtual) xattrs in metadata heal check Backport of http://review.gluster.org/#/c/15548/ Problem: In arbiter configuration, posix-xlator in the arbiter brick always sets the GF_CONTENT_KEY in the response dict with a value 0. If the file size on the data bricks is more than quick-read's max-file-size (64kb default), those bricks don't set the key. Because of this difference in the no. of dict elements, afr triggers metadata heal in lookup code path, in turn leading to extra lookups+inodelks. Fix: Changed afr dict comparison logic to ignore all virtual xattrs and the on-disk ones that we should not be healing. Change-Id: I05730bdd39d8fb0b9a49a5fc9c0bb01f0d3bb308 BUG: 1377193 Signed-off-by: Ravishankar N Reviewed-on: http://review.gluster.org/15578 Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System Reviewed-by: Pranith Kumar Karampuri --- libglusterfs/src/common-utils.c | 16 ++++++++++++++++ libglusterfs/src/common-utils.h | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index 973e31c636c..18f445ae265 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -4500,6 +4500,22 @@ gf_zero_fill_stat (struct iatt *buf) buf->ia_ctime = 0; } +gf_boolean_t +gf_is_valid_xattr_namespace (char *key) +{ + static char *xattr_namespaces[] = {"trusted.", "security.", "system.", + "user.", NULL }; + int i = 0; + + for (i = 0; xattr_namespaces[i]; i++) { + if (strncmp (key, xattr_namespaces[i], + strlen (xattr_namespaces[i])) == 0) + return _gf_true; + } + + return _gf_false; +} + int gf_bits_count (uint64_t n) { diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h index 93dee58b079..51264237ab4 100644 --- a/libglusterfs/src/common-utils.h +++ b/libglusterfs/src/common-utils.h @@ -835,7 +835,7 @@ void gf_zero_fill_stat (struct iatt *buf); gf_boolean_t -is_virtual_xattr (const char *k); +gf_is_valid_xattr_namespace (char *k); const char * gf_inode_type_to_str (ia_type_t type); -- cgit