e7a346
From bffd85fc848a02b69db27c8f4d9d0882e2859fc9 Mon Sep 17 00:00:00 2001
e7a346
From: moagrawa <moagrawa@redhat.com>
e7a346
Date: Wed, 6 Jun 2018 07:39:29 +0530
e7a346
Subject: [PATCH 297/305] dht: Delete MDS internal xattr from dict in
e7a346
 dht_getxattr_cbk
e7a346
e7a346
Problem: At the time of fetching xattr to heal xattr by afr
e7a346
         it is not able to fetch xattr because posix_getxattr
e7a346
         has a check to ignore if xattr name is MDS
e7a346
e7a346
Solution: To ignore same xattr update a check in dht_getxattr_cbk
e7a346
          instead of having a check in posix_getxattr
e7a346
e7a346
> BUG: 1584098
e7a346
> Change-Id: I86cd2b2ee08488cb6c12f407694219d57c5361dc
e7a346
> fixes: bz#1584098
e7a346
> cherry pick from commit 2c1131e5868e46cfc806fb3a1cb63a5e554b4d6c
e7a346
> (Upstream review link https://review.gluster.org/#/c/20102/)
e7a346
e7a346
BUG: 1582119
e7a346
Change-Id: I71894c0754a09994a3fe69915fb17b6adf2b86c5
e7a346
Signed-off-by: moagrawa <moagrawa@redhat.com>
e7a346
Reviewed-on: https://code.engineering.redhat.com/gerrit/140773
e7a346
Tested-by: RHGS Build Bot <nigelb@redhat.com>
e7a346
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
e7a346
---
e7a346
 xlators/cluster/dht/src/dht-common.c |  4 ++++
e7a346
 xlators/storage/posix/src/posix.c    | 31 -------------------------------
e7a346
 2 files changed, 4 insertions(+), 31 deletions(-)
e7a346
e7a346
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
e7a346
index 5f246b1..c6adce4 100644
e7a346
--- a/xlators/cluster/dht/src/dht-common.c
e7a346
+++ b/xlators/cluster/dht/src/dht-common.c
e7a346
@@ -4537,6 +4537,10 @@ dht_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
e7a346
                         dict_del (xattr, conf->xattr_name);
e7a346
                 }
e7a346
 
e7a346
+                if (dict_get (xattr,  conf->mds_xattr_key)) {
e7a346
+                        dict_del (xattr, conf->mds_xattr_key);
e7a346
+                }
e7a346
+
e7a346
                 if (frame->root->pid >= 0) {
e7a346
                         GF_REMOVE_INTERNAL_XATTR
e7a346
                                 ("trusted.glusterfs.quota*", xattr);
e7a346
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
e7a346
index 416d9e4..6aa64f9 100644
e7a346
--- a/xlators/storage/posix/src/posix.c
e7a346
+++ b/xlators/storage/posix/src/posix.c
e7a346
@@ -4626,26 +4626,6 @@ out:
e7a346
         return ret;
e7a346
 }
e7a346
 
e7a346
-gf_boolean_t
e7a346
-posix_is_mds_xattr (const char *name)
e7a346
-{
e7a346
-        regex_t regcmpl;
e7a346
-        char *key = {"trusted.glusterfs.*.mds$"};
e7a346
-        regmatch_t result[1] = {{0} };
e7a346
-        gf_boolean_t status = _gf_false;
e7a346
-
e7a346
-        if (regcomp (&regcmpl, key, REG_EXTENDED)) {
e7a346
-                goto out;
e7a346
-        }
e7a346
-        if (!regexec (&regcmpl, name, 1, result, 0)) {
e7a346
-                status = _gf_true;
e7a346
-                goto out;
e7a346
-        }
e7a346
-out:
e7a346
-        regfree(&regcmpl);
e7a346
-        return status;
e7a346
-}
e7a346
-
e7a346
 
e7a346
 /**
e7a346
  * posix_getxattr - this function returns a dictionary with all the
e7a346
@@ -4702,13 +4682,6 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
e7a346
                 goto out;
e7a346
         }
e7a346
 
e7a346
-        if (name && posix_is_mds_xattr (name)) {
e7a346
-                op_ret = -1;
e7a346
-                op_errno = ENOATTR;
e7a346
-                goto out;
e7a346
-        }
e7a346
-
e7a346
-
e7a346
         if (loc->inode && IA_ISDIR(loc->inode->ia_type) && name &&
e7a346
             ZR_FILE_CONTENT_REQUEST(name)) {
e7a346
                 ret = posix_get_file_contents (this, loc->gfid, &name[15],
e7a346
@@ -5078,10 +5051,6 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
e7a346
                         goto ignore;
e7a346
                 }
e7a346
 
e7a346
-                if (posix_is_mds_xattr (keybuffer)) {
e7a346
-                        goto ignore;
e7a346
-                }
e7a346
-
e7a346
                 memset (value_buf, '\0', sizeof(value_buf));
e7a346
                 have_val = _gf_false;
e7a346
                 size = sys_lgetxattr (real_path, keybuffer, value_buf,
e7a346
-- 
e7a346
1.8.3.1
e7a346