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 --- xlators/cluster/afr/src/afr-common.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'xlators/cluster/afr/src') diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c index 9b2c0d7caea..56c51131e3a 100644 --- a/xlators/cluster/afr/src/afr-common.c +++ b/xlators/cluster/afr/src/afr-common.c @@ -1706,10 +1706,6 @@ afr_frame_return (call_frame_t *frame) } static char *afr_ignore_xattrs[] = { - GLUSTERFS_OPEN_FD_COUNT, - GLUSTERFS_PARENT_ENTRYLK, - GLUSTERFS_ENTRYLK_COUNT, - GLUSTERFS_INODELK_COUNT, GF_SELINUX_XATTR_KEY, QUOTA_SIZE_KEY, NULL @@ -1730,8 +1726,13 @@ afr_is_xattr_ignorable (char *key) } static gf_boolean_t -afr_xattr_match (dict_t *this, char *key1, data_t *value1, void *data) +afr_xattr_match_needed (dict_t *this, char *key1, data_t *value1, void *data) { + /* Ignore all non-disk (i.e. virtual) xattrs right away. */ + if (!gf_is_valid_xattr_namespace (key1)) + return _gf_false; + + /* Ignore on-disk xattrs that AFR doesn't need to heal. */ if (!afr_is_xattr_ignorable (key1)) return _gf_true; @@ -1741,7 +1742,7 @@ afr_xattr_match (dict_t *this, char *key1, data_t *value1, void *data) gf_boolean_t afr_xattrs_are_equal (dict_t *dict1, dict_t *dict2) { - return are_dicts_equal (dict1, dict2, afr_xattr_match, NULL); + return are_dicts_equal (dict1, dict2, afr_xattr_match_needed, NULL); } static int -- cgit