diff options
| -rw-r--r-- | libglusterfs/src/common-utils.c | 16 | ||||
| -rw-r--r-- | libglusterfs/src/common-utils.h | 2 | ||||
| -rw-r--r-- | xlators/cluster/afr/src/afr-common.c | 13 | ||||
| -rw-r--r-- | xlators/storage/posix/src/posix-helpers.c | 18 | 
4 files changed, 25 insertions, 24 deletions
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); 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 diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c index f93e81589a5..d92839827b4 100644 --- a/xlators/storage/posix/src/posix-helpers.c +++ b/xlators/storage/posix/src/posix-helpers.c @@ -116,22 +116,6 @@ posix_xattr_ignorable (char *key)          return _is_in_array (posix_ignore_xattrs, key);  } -static gf_boolean_t -posix_is_valid_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; -} -  static int  _posix_xattr_get_set_from_backend (posix_xattr_filler_t *filler, char *key)  { @@ -141,7 +125,7 @@ _posix_xattr_get_set_from_backend (posix_xattr_filler_t *filler, char *key)          char     val_buf[256] = {0};          gf_boolean_t have_val   = _gf_false; -        if (!posix_is_valid_namespace (key)) { +        if (!gf_is_valid_xattr_namespace (key)) {                  ret = -1;                  goto out;          }  | 
