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