7f4c2a
From e41916c72748a0997dbdd56e2f33525322944ac5 Mon Sep 17 00:00:00 2001
7f4c2a
From: Xavier Hernandez <xhernandez@datalab.es>
7f4c2a
Date: Sun, 31 May 2015 19:53:41 +0200
7f4c2a
Subject: [PATCH 171/190] cluster/ec: Fix incorrect check for iatt differences
7f4c2a
7f4c2a
A previous patch (http://review.gluster.org/10974) introduced a
7f4c2a
bug that caused that some metadata differences could not be
7f4c2a
detected in some circumstances. This could cause that self-heal
7f4c2a
is not triggered and the file not repaired.
7f4c2a
7f4c2a
We also need to consider all differences for lookup requests, even
7f4c2a
if there isn't any lock. Special handling of differences in lookup
7f4c2a
is already done in lookup specific code.
7f4c2a
7f4c2a
Backporting patch http://review.gluster.org/#/c/11018/
7f4c2a
7f4c2a
cherry-pick of commit 29d5bd5fc8a7b24865801de9f2e3f10d55af6e85
7f4c2a
>Change-Id: I3766b0f412b3201ae8a04664349578713572edc6
7f4c2a
>BUG: 1225793
7f4c2a
>Signed-off-by: Xavier Hernandez <xhernandez@datalab.es>
7f4c2a
>Reviewed-on: http://review.gluster.org/11018
7f4c2a
>Tested-by: Gluster Build System <jenkins@build.gluster.com>
7f4c2a
>Tested-by: NetBSD Build System <jenkins@build.gluster.org>
7f4c2a
>Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
7f4c2a
7f4c2a
Change-Id: I3766b0f412b3201ae8a04664349578713572edc6
7f4c2a
BUG: 1226149
7f4c2a
Signed-off-by: Nandaja Varma <nvarma@redhat.com>
7f4c2a
Reviewed-on: https://code.engineering.redhat.com/gerrit/51747
7f4c2a
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
7f4c2a
Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
7f4c2a
---
7f4c2a
 xlators/cluster/ec/src/ec-combine.c |   24 +++++++++++++++++++-----
7f4c2a
 1 files changed, 19 insertions(+), 5 deletions(-)
7f4c2a
7f4c2a
diff --git a/xlators/cluster/ec/src/ec-combine.c b/xlators/cluster/ec/src/ec-combine.c
7f4c2a
index bf698d9..d55e42a 100644
7f4c2a
--- a/xlators/cluster/ec/src/ec-combine.c
7f4c2a
+++ b/xlators/cluster/ec/src/ec-combine.c
7f4c2a
@@ -131,6 +131,15 @@ ec_iatt_is_trusted(ec_fop_data_t *fop, struct iatt *iatt)
7f4c2a
         fop = fop->parent;
7f4c2a
     }
7f4c2a
 
7f4c2a
+    /* Lookups are special requests always done without locks taken but they
7f4c2a
+     * require to be able to identify differences between bricks. Special
7f4c2a
+     * handling of these differences is already done in lookup specific code
7f4c2a
+     * so we shouldn't ignore any difference here and consider all iatt
7f4c2a
+     * structures as trusted. */
7f4c2a
+    if (fop->id == GF_FOP_LOOKUP) {
7f4c2a
+        return _gf_true;
7f4c2a
+    }
7f4c2a
+
7f4c2a
     /* Check if the iatt references an inode locked by the current fop */
7f4c2a
     for (i = 0; i < fop->lock_count; i++) {
7f4c2a
         ino = gfid_to_ino(fop->locks[i].lock->loc.inode->gfid);
7f4c2a
@@ -168,15 +177,20 @@ int32_t ec_iatt_combine(ec_fop_data_t *fop, struct iatt *dst, struct iatt *src,
7f4c2a
                          (dst[i].ia_size != src[i].ia_size)) ||
7f4c2a
                         (st_mode_from_ia(dst[i].ia_prot, dst[i].ia_type) !=
7f4c2a
                          st_mode_from_ia(src[i].ia_prot, src[i].ia_type)))) {
7f4c2a
-            if (!ec_iatt_is_trusted(fop, dst)) {
7f4c2a
-                /* If the iatt contains information from an inode that is not
7f4c2a
-                 * locked, we ignore these differences and don't care which
7f4c2a
+            if (ec_iatt_is_trusted(fop, dst)) {
7f4c2a
+                /* If the iatt contains information from an inode that is
7f4c2a
+                 * locked, these differences are real problems, so we need to
7f4c2a
+                 * report them. Otherwise we ignore them and don't care which
7f4c2a
                  * data is returned. */
7f4c2a
-                failed = _gf_false;
7f4c2a
+                failed = _gf_true;
7f4c2a
+            } else {
7f4c2a
+                gf_log(fop->xl->name, GF_LOG_DEBUG,
7f4c2a
+                       "Ignoring iatt differences because inode is not "
7f4c2a
+                       "locked");
7f4c2a
             }
7f4c2a
         }
7f4c2a
         if (failed) {
7f4c2a
-            gf_log(THIS->name, GF_LOG_WARNING,
7f4c2a
+            gf_log(fop->xl->name, GF_LOG_WARNING,
7f4c2a
                    "Failed to combine iatt (inode: %lu-%lu, links: %u-%u, "
7f4c2a
                    "uid: %u-%u, gid: %u-%u, rdev: %lu-%lu, size: %lu-%lu, "
7f4c2a
                    "mode: %o-%o)",
7f4c2a
-- 
7f4c2a
1.7.1
7f4c2a