a3470f
From 2de9ac218241648f1ec86b73aac728d713862a30 Mon Sep 17 00:00:00 2001
a3470f
From: moagrawa <moagrawa@redhat.com>
a3470f
Date: Fri, 4 May 2018 16:17:42 +0530
a3470f
Subject: [PATCH 254/260] posix: Avoid changelog retries for geo-rep
a3470f
a3470f
Problem: georep is slowdown to migrate directory
a3470f
         from master volume to slave volume due to lot
a3470f
         of changelog retries
a3470f
a3470f
Solution: Update the condition in posix_getxattr to
a3470f
          ignore MDS_INTERNAL_XATTR as it(posix) ignored
a3470f
          other internal xattrs
a3470f
a3470f
> BUG: 1571069
a3470f
> Change-Id: I4d91ec73e5b1ca1cb3ecf0825ab9f49e261da70e
a3470f
> fixes: bz#1571069
a3470f
> Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
a3470f
> (cherry picked from commit f46047ea0f36084f4456887673552a01b926382d)
a3470f
> (Reviewed on: https://review.gluster.org/#/c/19930/)
a3470f
a3470f
BUG: 1565577
a3470f
Change-Id: I85b2e8ed4adcbe34ee5a03acd068693978e9cfe4
a3470f
Signed-off-by: moagrawa <moagrawa@redhat.com>
a3470f
Reviewed-on: https://code.engineering.redhat.com/gerrit/137779
a3470f
Tested-by: RHGS Build Bot <nigelb@redhat.com>
a3470f
Reviewed-by: Kotresh Hiremath Ravishankar <khiremat@redhat.com>
a3470f
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
a3470f
---
a3470f
 xlators/storage/posix/src/posix.c | 33 +++++++++++++++++++++++++++++++++
a3470f
 1 file changed, 33 insertions(+)
a3470f
a3470f
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
a3470f
index c680e3f..416d9e4 100644
a3470f
--- a/xlators/storage/posix/src/posix.c
a3470f
+++ b/xlators/storage/posix/src/posix.c
a3470f
@@ -27,6 +27,7 @@
a3470f
 #include <sys/uio.h>
a3470f
 #include <unistd.h>
a3470f
 #include <ftw.h>
a3470f
+#include <regex.h>
a3470f
 
a3470f
 #ifndef GF_BSD_HOST_OS
a3470f
 #include <alloca.h>
a3470f
@@ -4625,6 +4626,27 @@ 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
  *                  key:value pair present as xattr. used for
a3470f
@@ -4680,6 +4702,13 @@ 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
@@ -5049,6 +5078,10 @@ 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