d84cf8
From b603170ae5f583037b8177a9d19e56c7821edf0b Mon Sep 17 00:00:00 2001
d84cf8
From: Pranith Kumar K <pkarampu@redhat.com>
d84cf8
Date: Tue, 25 Aug 2020 04:19:54 +0530
d84cf8
Subject: [PATCH 466/466] cluster/ec: Change stale index handling
d84cf8
d84cf8
Problem:
d84cf8
Earlier approach is setting dirty bit which requires extra heal
d84cf8
d84cf8
Fix:
d84cf8
Send zero-xattrop which deletes stale index without any need
d84cf8
for extra heal.
d84cf8
d84cf8
 > Fixes: #1385
d84cf8
 > Upstream-patch: https://review.gluster.org/c/glusterfs/+/24911/
d84cf8
d84cf8
BUG: 1785714
d84cf8
Change-Id: I7e97a1d8b5516f7be47cae55d0e56b14332b6cae
d84cf8
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
d84cf8
Reviewed-on: https://code.engineering.redhat.com/gerrit/209904
d84cf8
Tested-by: RHGS Build Bot <nigelb@redhat.com>
d84cf8
Tested-by: Ashish Pandey <aspandey@redhat.com>
d84cf8
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
d84cf8
---
d84cf8
 xlators/cluster/ec/src/ec-heal.c | 14 +++++---------
d84cf8
 1 file changed, 5 insertions(+), 9 deletions(-)
d84cf8
d84cf8
diff --git a/xlators/cluster/ec/src/ec-heal.c b/xlators/cluster/ec/src/ec-heal.c
d84cf8
index 6e6948b..06bafa5 100644
d84cf8
--- a/xlators/cluster/ec/src/ec-heal.c
d84cf8
+++ b/xlators/cluster/ec/src/ec-heal.c
d84cf8
@@ -2490,7 +2490,7 @@ out:
d84cf8
 }
d84cf8
 
d84cf8
 int
d84cf8
-ec_heal_set_dirty_without_lock(call_frame_t *frame, ec_t *ec, inode_t *inode)
d84cf8
+ec_heal_purge_stale_index(call_frame_t *frame, ec_t *ec, inode_t *inode)
d84cf8
 {
d84cf8
     int i = 0;
d84cf8
     int ret = 0;
d84cf8
@@ -2520,7 +2520,6 @@ ec_heal_set_dirty_without_lock(call_frame_t *frame, ec_t *ec, inode_t *inode)
d84cf8
         xattr[i] = dict;
d84cf8
         on[i] = 1;
d84cf8
     }
d84cf8
-    dirty_xattr[EC_METADATA_TXN] = hton64(1);
d84cf8
     ret = dict_set_static_bin(dict, EC_XATTR_DIRTY, dirty_xattr,
d84cf8
                               (sizeof(*dirty_xattr) * EC_VERSION_SIZE));
d84cf8
     if (ret < 0) {
d84cf8
@@ -2621,13 +2620,10 @@ ec_heal_do(xlator_t *this, void *data, loc_t *loc, int32_t partial)
d84cf8
             gf_msg(ec->xl->name, GF_LOG_INFO, 0, EC_MSG_HEAL_FAIL,
d84cf8
                    "Index entry needs to be purged for: %s ",
d84cf8
                    uuid_utoa(loc->gfid));
d84cf8
-            /* We need to send xattrop to set dirty flag so that it can be
d84cf8
-             * healed and index entry could be removed. We need not to take lock
d84cf8
-             * on this entry to do so as we are just setting dirty flag which
d84cf8
-             * actually increases the trusted.ec.dirty count and does not set
d84cf8
-             * the new value.
d84cf8
-             * This will make sure that it is not interfering in other fops.*/
d84cf8
-            ec_heal_set_dirty_without_lock(frame, ec, loc->inode);
d84cf8
+            /* We need to send zero-xattrop so that stale index entry could be
d84cf8
+             * removed. We need not take lock on this entry to do so as
d84cf8
+             * xattrop on a brick is atomic. */
d84cf8
+            ec_heal_purge_stale_index(frame, ec, loc->inode);
d84cf8
         } else if (need_heal == EC_HEAL_NONEED) {
d84cf8
             gf_msg(ec->xl->name, GF_LOG_DEBUG, 0, EC_MSG_HEAL_FAIL,
d84cf8
                    "Heal is not required for : %s ", uuid_utoa(loc->gfid));
d84cf8
-- 
d84cf8
1.8.3.1
d84cf8