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