c5d8c8
From 08c57926118b1ab8fa1fcd5b16913ff22d97d065 Mon Sep 17 00:00:00 2001
c5d8c8
From: N Balachandran <nbalacha@redhat.com>
c5d8c8
Date: Wed, 25 Sep 2019 19:50:27 +0530
c5d8c8
Subject: [PATCH 547/584] perf/write-behind: Clear frame->local on conflict
c5d8c8
 error
c5d8c8
c5d8c8
WB saves the wb_inode in frame->local for the truncate and
c5d8c8
ftruncate fops. This value is not cleared in case of error
c5d8c8
on a conflicting write request. FRAME_DESTROY finds a non-null
c5d8c8
frame->local and tries to free it using mem_put. However,
c5d8c8
wb_inode is allocated using GF_CALLOC, causing the
c5d8c8
process to crash.
c5d8c8
c5d8c8
credit: vpolakis@gmail.com
c5d8c8
c5d8c8
Upstream Patch: https://review.gluster.org/#/c/glusterfs/+/23485/
c5d8c8
>Change-Id: I217f61470445775e05145aebe44c814731c1b8c5
c5d8c8
>Fixes: bz#1753592
c5d8c8
>Signed-off-by: N Balachandran <nbalacha@redhat.com>
c5d8c8
c5d8c8
BUG: 1917488
c5d8c8
Change-Id: I217f61470445775e05145aebe44c814731c1b8c5
c5d8c8
Signed-off-by: Sunil Kumar H G <sheggodu@redhat.com>
c5d8c8
Reviewed-on: https://code.engineering.redhat.com/gerrit/c/rhs-glusterfs/+/244277
c5d8c8
Tested-by: RHGS Build Bot <nigelb@redhat.com>
c5d8c8
---
c5d8c8
 xlators/performance/write-behind/src/write-behind.c | 4 ++++
c5d8c8
 1 file changed, 4 insertions(+)
c5d8c8
c5d8c8
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c
c5d8c8
index 90a0bcf..31ab723 100644
c5d8c8
--- a/xlators/performance/write-behind/src/write-behind.c
c5d8c8
+++ b/xlators/performance/write-behind/src/write-behind.c
c5d8c8
@@ -1523,6 +1523,10 @@ __wb_handle_failed_conflict(wb_request_t *req, wb_request_t *conflict,
c5d8c8
              */
c5d8c8
             req->op_ret = -1;
c5d8c8
             req->op_errno = conflict->op_errno;
c5d8c8
+            if ((req->stub->fop == GF_FOP_TRUNCATE) ||
c5d8c8
+                (req->stub->fop == GF_FOP_FTRUNCATE)) {
c5d8c8
+                req->stub->frame->local = NULL;
c5d8c8
+            }
c5d8c8
 
c5d8c8
             list_del_init(&req->todo);
c5d8c8
             list_add_tail(&req->winds, tasks);
c5d8c8
-- 
c5d8c8
1.8.3.1
c5d8c8