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>
This commit is contained in:
Vijay Bellur 2019-01-10 11:08:49 -08:00 committed by Raghavendra G
parent 99ac5a8380
commit fa7ae12870
2 changed files with 26 additions and 2 deletions

View File

@ -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;

View File

@ -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;
}