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