diff options
author | Vijay Bellur <vbellur@redhat.com> | 2019-01-10 11:08:49 -0800 |
---|---|---|
committer | Raghavendra G <rgowdapp@redhat.com> | 2019-01-11 03:23:35 +0000 |
commit | fa7ae128706062afefcb0a3117527b8bef21f396 (patch) | |
tree | 70dc227ee6127ccb42b176d8a492db8235e0a9d0 | |
parent | 99ac5a83805e46659124acfefbc05c9b6dda1a1b (diff) |
performance/md-cache: Fix a crash when statfs caching is enabled
mem_put() in STACK_UNWIND_STRICT causes a crash if frame->local is not null
as md-cache obtains local from CALLOC.
Changed two occurrences of STACK_UNWIND_STRICT to MDC_STACK_UNWIND as
the latter macro does not rely on STACK_UNWIND_STRICT for cleaning up
frame->local.
fixes: bz#1632503
Change-Id: I1b3edcb9372a164ef73119e99a49e747765d7166
Signed-off-by: Vijay Bellur <vbellur@redhat.com>
-rwxr-xr-x | tests/bugs/md-cache/bug-1632503.t | 24 | ||||
-rw-r--r-- | xlators/performance/md-cache/src/md-cache.c | 4 |
2 files changed, 26 insertions, 2 deletions
diff --git a/tests/bugs/md-cache/bug-1632503.t b/tests/bugs/md-cache/bug-1632503.t new file mode 100755 index 00000000000..aeb57f65639 --- /dev/null +++ b/tests/bugs/md-cache/bug-1632503.t @@ -0,0 +1,24 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; +TESTS_EXPECTED_IN_LOOP=5 + +TEST glusterd; + +TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2,3}; + +TEST $CLI volume start $V0 + +TEST $CLI volume set $V0 performance.md-cache-timeout 600 +TEST $CLI volume set $V0 performance.md-cache-statfs on + +TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 + +for i in $(seq 1 5); do + TEST_IN_LOOP df $M0; +done + +cleanup; diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c index 1f19d5b2c79..ff5c8c2f914 100644 --- a/xlators/performance/md-cache/src/md-cache.c +++ b/xlators/performance/md-cache/src/md-cache.c @@ -1174,7 +1174,7 @@ uncached: return 0; out: - STACK_UNWIND_STRICT(statfs, frame, op_ret, op_errno, buf, xdata); + MDC_STACK_UNWIND(statfs, frame, op_ret, op_errno, buf, xdata); return 0; } @@ -2834,7 +2834,7 @@ mdc_readdirp(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, dict_unref(xattr_alloc); return 0; out: - STACK_UNWIND_STRICT(readdirp, frame, -1, ENOMEM, NULL, NULL); + MDC_STACK_UNWIND(readdirp, frame, -1, ENOMEM, NULL, NULL); return 0; } |