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