256ebe
From 40bd6e9c186adb427e136a84eaab631e6a6f5263 Mon Sep 17 00:00:00 2001
256ebe
From: Pranith Kumar K <pkarampu@redhat.com>
256ebe
Date: Sun, 5 May 2019 21:17:24 +0530
256ebe
Subject: [PATCH 140/141] cluster/ec: Reopen shouldn't happen with O_TRUNC
256ebe
256ebe
Problem:
256ebe
Doing re-open with O_TRUNC will truncate the fragment even when it is not
256ebe
needed needing extra heals
256ebe
256ebe
Fix:
256ebe
At the time of re-open don't use O_TRUNC.
256ebe
256ebe
Upstream-patch: https://review.gluster.org/c/glusterfs/+/22660/
256ebe
256ebe
fixes bz#1706549
256ebe
Change-Id: Idc6408968efaad897b95a5a52481c66e843d3fb8
256ebe
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
256ebe
Reviewed-on: https://code.engineering.redhat.com/gerrit/169982
256ebe
Tested-by: RHGS Build Bot <nigelb@redhat.com>
256ebe
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
256ebe
---
256ebe
 xlators/cluster/ec/src/ec-common.c | 2 +-
256ebe
 1 file changed, 1 insertion(+), 1 deletion(-)
256ebe
256ebe
diff --git a/xlators/cluster/ec/src/ec-common.c b/xlators/cluster/ec/src/ec-common.c
256ebe
index 1454ae2..b1ba5e9 100644
256ebe
--- a/xlators/cluster/ec/src/ec-common.c
256ebe
+++ b/xlators/cluster/ec/src/ec-common.c
256ebe
@@ -128,7 +128,7 @@ ec_fix_open(ec_fop_data_t *fop, uintptr_t mask)
256ebe
     } else {
256ebe
         ec_open(fop->frame, fop->xl, need_open,
256ebe
                 EC_MINIMUM_ONE | EC_FOP_NO_PROPAGATE_ERROR, NULL, NULL, &loc,
256ebe
-                fop->fd->flags, fop->fd, NULL);
256ebe
+                fop->fd->flags & (~O_TRUNC), fop->fd, NULL);
256ebe
     }
256ebe
 
256ebe
 out:
256ebe
-- 
256ebe
1.8.3.1
256ebe