14f8ab
From 5a110946b41619577b365cdceddc4da551ff49f0 Mon Sep 17 00:00:00 2001
14f8ab
From: kinsu <vpolakis@gmail.com>
14f8ab
Date: Thu, 19 Sep 2019 08:34:32 +0000
14f8ab
Subject: [PATCH 490/511] Segmentation fault occurs during truncate
14f8ab
14f8ab
Problem:
14f8ab
Segmentation fault occurs when bricks are nearly full 100% and in
14f8ab
parallel truncate of a file is attempted (No space left on device).
14f8ab
Prerequicite is that performance xlators are activated
14f8ab
(read-ahead, write-behind etc)
14f8ab
while stack unwind of the frames following an error responce
14f8ab
from brick (No space left on device) frame->local includes a memory
14f8ab
location that is not allocated via mem_get but via calloc.
14f8ab
The destroyed frame is always ra_truncate_cbk winded from ra_ftruncate
14f8ab
and the inode ptr is copied to the frame local in the wb_ftruncate.
14f8ab
14f8ab
Fix:
14f8ab
extra check is added for the pool ptr
14f8ab
14f8ab
>Change-Id: Ic5d3bd0ab7011e40b2811c6dece063b256e4d9d1
14f8ab
>Fixes: bz#1797882
14f8ab
>Signed-off-by: kinsu <vpolakis@gmail.com>
14f8ab
14f8ab
Upstream-patch: https://review.gluster.org/c/glusterfs/+/23445
14f8ab
14f8ab
BUG: 1842449
14f8ab
Change-Id: Ic5d3bd0ab7011e40b2811c6dece063b256e4d9d1
14f8ab
Signed-off-by: nik-redhat <nladha@redhat.com>
14f8ab
Reviewed-on: https://code.engineering.redhat.com/gerrit/220540
14f8ab
Tested-by: RHGS Build Bot <nigelb@redhat.com>
14f8ab
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
14f8ab
---
14f8ab
 libglusterfs/src/mem-pool.c | 8 ++++++++
14f8ab
 1 file changed, 8 insertions(+)
14f8ab
14f8ab
diff --git a/libglusterfs/src/mem-pool.c b/libglusterfs/src/mem-pool.c
14f8ab
index 73503e0..1390747 100644
14f8ab
--- a/libglusterfs/src/mem-pool.c
14f8ab
+++ b/libglusterfs/src/mem-pool.c
14f8ab
@@ -857,6 +857,14 @@ mem_put(void *ptr)
14f8ab
         /* Not one of ours; don't touch it. */
14f8ab
         return;
14f8ab
     }
14f8ab
+
14f8ab
+    if (!hdr->pool_list) {
14f8ab
+        gf_msg_callingfn("mem-pool", GF_LOG_CRITICAL, EINVAL,
14f8ab
+                         LG_MSG_INVALID_ARG,
14f8ab
+                         "invalid argument hdr->pool_list NULL");
14f8ab
+        return;
14f8ab
+    }
14f8ab
+
14f8ab
     pool_list = hdr->pool_list;
14f8ab
     pt_pool = &pool_list->pools[hdr->power_of_two - POOL_SMALLEST];
14f8ab
 
14f8ab
-- 
14f8ab
1.8.3.1
14f8ab