|
|
3604df |
From 6bf6d849b209b4214ba8b468dc0fb2574dba0c04 Mon Sep 17 00:00:00 2001
|
|
|
3604df |
From: Ravishankar N <ravishankar@redhat.com>
|
|
|
3604df |
Date: Tue, 27 Sep 2016 12:50:50 +0530
|
|
|
3604df |
Subject: [PATCH 92/94] afr: Ignore gluster internal (virtual) xattrs in metadata heal check
|
|
|
3604df |
|
|
|
3604df |
Patch in master:http://review.gluster.org/#/c/15548/
|
|
|
3604df |
Patch in release-3.9:http://review.gluster.org/#/c/15577/
|
|
|
3604df |
Patch in release-3.8:http://review.gluster.org/#/c/15578/
|
|
|
3604df |
|
|
|
3604df |
Problem:
|
|
|
3604df |
In arbiter configuration, posix-xlator in the arbiter brick always sets
|
|
|
3604df |
the GF_CONTENT_KEY in the response dict with a value 0. If the file size on
|
|
|
3604df |
the data bricks is more than quick-read's max-file-size (64kb default),
|
|
|
3604df |
those bricks don't set the key. Because of this difference in the no. of dict
|
|
|
3604df |
elements, afr triggers metadata heal in lookup code path, in turn
|
|
|
3604df |
leading to extra lookups+inodelks.
|
|
|
3604df |
|
|
|
3604df |
Fix:
|
|
|
3604df |
Changed afr dict comparison logic to ignore all virtual xattrs and the
|
|
|
3604df |
on-disk ones that we should not be healing.
|
|
|
3604df |
|
|
|
3604df |
Change-Id: I1ab0c9018c65efef97b052a00ee73f79cc7476c0
|
|
|
3604df |
BUG: 1378867
|
|
|
3604df |
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
|
|
|
3604df |
Reviewed-on: https://code.engineering.redhat.com/gerrit/85739
|
|
|
3604df |
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
|
|
|
3604df |
Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
|
|
|
3604df |
---
|
|
|
3604df |
libglusterfs/src/common-utils.c | 16 ++++++++++++++++
|
|
|
3604df |
libglusterfs/src/common-utils.h | 2 +-
|
|
|
3604df |
xlators/cluster/afr/src/afr-common.c | 13 +++++++------
|
|
|
3604df |
xlators/storage/posix/src/posix-helpers.c | 18 +-----------------
|
|
|
3604df |
4 files changed, 25 insertions(+), 24 deletions(-)
|
|
|
3604df |
|
|
|
3604df |
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
|
|
|
3604df |
index e51933d..0ee956c 100644
|
|
|
3604df |
--- a/libglusterfs/src/common-utils.c
|
|
|
3604df |
+++ b/libglusterfs/src/common-utils.c
|
|
|
3604df |
@@ -4533,6 +4533,22 @@ gf_zero_fill_stat (struct iatt *buf)
|
|
|
3604df |
buf->ia_ctime = 0;
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
+gf_boolean_t
|
|
|
3604df |
+gf_is_valid_xattr_namespace (char *key)
|
|
|
3604df |
+{
|
|
|
3604df |
+ static char *xattr_namespaces[] = {"trusted.", "security.", "system.",
|
|
|
3604df |
+ "user.", NULL };
|
|
|
3604df |
+ int i = 0;
|
|
|
3604df |
+
|
|
|
3604df |
+ for (i = 0; xattr_namespaces[i]; i++) {
|
|
|
3604df |
+ if (strncmp (key, xattr_namespaces[i],
|
|
|
3604df |
+ strlen (xattr_namespaces[i])) == 0)
|
|
|
3604df |
+ return _gf_true;
|
|
|
3604df |
+ }
|
|
|
3604df |
+
|
|
|
3604df |
+ return _gf_false;
|
|
|
3604df |
+}
|
|
|
3604df |
+
|
|
|
3604df |
int
|
|
|
3604df |
gf_bits_count (uint64_t n)
|
|
|
3604df |
{
|
|
|
3604df |
diff --git a/libglusterfs/src/common-utils.h b/libglusterfs/src/common-utils.h
|
|
|
3604df |
index d71c143..3aecc02 100644
|
|
|
3604df |
--- a/libglusterfs/src/common-utils.h
|
|
|
3604df |
+++ b/libglusterfs/src/common-utils.h
|
|
|
3604df |
@@ -844,7 +844,7 @@ void
|
|
|
3604df |
gf_zero_fill_stat (struct iatt *buf);
|
|
|
3604df |
|
|
|
3604df |
gf_boolean_t
|
|
|
3604df |
-is_virtual_xattr (const char *k);
|
|
|
3604df |
+gf_is_valid_xattr_namespace (char *k);
|
|
|
3604df |
|
|
|
3604df |
const char *
|
|
|
3604df |
gf_inode_type_to_str (ia_type_t type);
|
|
|
3604df |
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
|
|
|
3604df |
index db6a350..97d6f2f 100644
|
|
|
3604df |
--- a/xlators/cluster/afr/src/afr-common.c
|
|
|
3604df |
+++ b/xlators/cluster/afr/src/afr-common.c
|
|
|
3604df |
@@ -1708,10 +1708,6 @@ afr_frame_return (call_frame_t *frame)
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
static char *afr_ignore_xattrs[] = {
|
|
|
3604df |
- GLUSTERFS_OPEN_FD_COUNT,
|
|
|
3604df |
- GLUSTERFS_PARENT_ENTRYLK,
|
|
|
3604df |
- GLUSTERFS_ENTRYLK_COUNT,
|
|
|
3604df |
- GLUSTERFS_INODELK_COUNT,
|
|
|
3604df |
GF_SELINUX_XATTR_KEY,
|
|
|
3604df |
QUOTA_SIZE_KEY,
|
|
|
3604df |
NULL
|
|
|
3604df |
@@ -1732,8 +1728,13 @@ afr_is_xattr_ignorable (char *key)
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
static gf_boolean_t
|
|
|
3604df |
-afr_xattr_match (dict_t *this, char *key1, data_t *value1, void *data)
|
|
|
3604df |
+afr_xattr_match_needed (dict_t *this, char *key1, data_t *value1, void *data)
|
|
|
3604df |
{
|
|
|
3604df |
+ /* Ignore all non-disk (i.e. virtual) xattrs right away. */
|
|
|
3604df |
+ if (!gf_is_valid_xattr_namespace (key1))
|
|
|
3604df |
+ return _gf_false;
|
|
|
3604df |
+
|
|
|
3604df |
+ /* Ignore on-disk xattrs that AFR doesn't need to heal. */
|
|
|
3604df |
if (!afr_is_xattr_ignorable (key1))
|
|
|
3604df |
return _gf_true;
|
|
|
3604df |
|
|
|
3604df |
@@ -1743,7 +1744,7 @@ afr_xattr_match (dict_t *this, char *key1, data_t *value1, void *data)
|
|
|
3604df |
gf_boolean_t
|
|
|
3604df |
afr_xattrs_are_equal (dict_t *dict1, dict_t *dict2)
|
|
|
3604df |
{
|
|
|
3604df |
- return are_dicts_equal (dict1, dict2, afr_xattr_match, NULL);
|
|
|
3604df |
+ return are_dicts_equal (dict1, dict2, afr_xattr_match_needed, NULL);
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
static int
|
|
|
3604df |
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c
|
|
|
3604df |
index f52836f..86c3339 100644
|
|
|
3604df |
--- a/xlators/storage/posix/src/posix-helpers.c
|
|
|
3604df |
+++ b/xlators/storage/posix/src/posix-helpers.c
|
|
|
3604df |
@@ -117,22 +117,6 @@ posix_xattr_ignorable (char *key)
|
|
|
3604df |
return _is_in_array (posix_ignore_xattrs, key);
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
-static gf_boolean_t
|
|
|
3604df |
-posix_is_valid_namespace (char *key)
|
|
|
3604df |
-{
|
|
|
3604df |
- static char *xattr_namespaces[] = {"trusted.", "security.", "system.",
|
|
|
3604df |
- "user.", NULL };
|
|
|
3604df |
- int i = 0;
|
|
|
3604df |
-
|
|
|
3604df |
- for (i = 0; xattr_namespaces[i]; i++) {
|
|
|
3604df |
- if (strncmp (key, xattr_namespaces[i],
|
|
|
3604df |
- strlen (xattr_namespaces[i])) == 0)
|
|
|
3604df |
- return _gf_true;
|
|
|
3604df |
- }
|
|
|
3604df |
-
|
|
|
3604df |
- return _gf_false;
|
|
|
3604df |
-}
|
|
|
3604df |
-
|
|
|
3604df |
static int
|
|
|
3604df |
_posix_xattr_get_set_from_backend (posix_xattr_filler_t *filler, char *key)
|
|
|
3604df |
{
|
|
|
3604df |
@@ -142,7 +126,7 @@ _posix_xattr_get_set_from_backend (posix_xattr_filler_t *filler, char *key)
|
|
|
3604df |
char val_buf[256] = {0};
|
|
|
3604df |
gf_boolean_t have_val = _gf_false;
|
|
|
3604df |
|
|
|
3604df |
- if (!posix_is_valid_namespace (key)) {
|
|
|
3604df |
+ if (!gf_is_valid_xattr_namespace (key)) {
|
|
|
3604df |
ret = -1;
|
|
|
3604df |
goto out;
|
|
|
3604df |
}
|
|
|
3604df |
--
|
|
|
3604df |
1.7.1
|
|
|
3604df |
|