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