Blob Blame History Raw
From afff5f5aaab363afebb8fd359af2b8403b992930 Mon Sep 17 00:00:00 2001
From: Ashish Pandey <aspandey@redhat.com>
Date: Thu, 6 Sep 2018 11:20:32 +0530
Subject: [PATCH 447/450] cluster/ec: Don't update trusted.ec.version if fop
 succeeds

If a fop has succeeded on all the bricks and trying to release
the lock, there is no need to update the version for the
file/entry. All it will do is to increase the version from
x to x+1 on all the bricks.

If this update (x to x+1) fails on some brick, this will indicate
that the entry is unhealthy while in realty everything is fine
with the entry.

Avoiding this update will help to not to send one xattrop
at the end of the fops. Which will decrease the chances
of entries being in unhealthy state and also improve the
performance.

upstream patch : https://review.gluster.org/#/c/glusterfs/+/21105

Change-Id: Id9fca6bd2991425db6ed7d1f36af27027accb636
BUG: 1626350
Signed-off-by: Ashish Pandey <aspandey@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/156342
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
 xlators/cluster/ec/src/ec-common.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/xlators/cluster/ec/src/ec-common.c b/xlators/cluster/ec/src/ec-common.c
index 6d0eb62..a7a8234 100644
--- a/xlators/cluster/ec/src/ec-common.c
+++ b/xlators/cluster/ec/src/ec-common.c
@@ -2372,6 +2372,15 @@ ec_update_info(ec_lock_link_t *link)
                     if (ctx->dirty[1] != 0) {
                         dirty[1] = -1;
                     }
+                    /*If everything is fine and we already
+                     *have version xattr set on entry, there
+                     *is no need to update version again*/
+                    if (ctx->pre_version[0]) {
+                        version[0] = 0;
+                    }
+                    if (ctx->pre_version[1]) {
+                        version[1] = 0;
+                    }
             } else {
                     link->optimistic_changelog = _gf_false;
                     ec_set_dirty_flag (link, ctx, dirty);
-- 
1.8.3.1