lib/reduce: move _alloc_zero_buf earlier in init stage.
In the reduce_dev_destroy case, we were not calling alloc_zero_buf in the load path because of a built in short circuit. This resulted in us decrementing the g_vol_count variable past 0 in cases where we were destroying a reduce volume that we had already freed. This resulted in us failing to allocate the g_zero_buf the next time we loaded a reduce volume. Change-Id: I429cbac1454bdcda502038af659d5302627ecab2 Signed-off-by: Seth Howell <seth.howell@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/478127 Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
d4e15650aa
commit
d0ff231e36
@ -662,6 +662,11 @@ _load_read_super_and_path_cpl(void *cb_arg, int reduce_errno)
|
||||
uint32_t j;
|
||||
int rc;
|
||||
|
||||
rc = _alloc_zero_buff();
|
||||
if (rc) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (memcmp(vol->backing_super->signature,
|
||||
SPDK_REDUCE_SIGNATURE,
|
||||
sizeof(vol->backing_super->signature)) != 0) {
|
||||
@ -738,11 +743,6 @@ _load_read_super_and_path_cpl(void *cb_arg, int reduce_errno)
|
||||
}
|
||||
}
|
||||
|
||||
rc = _alloc_zero_buff();
|
||||
if (rc) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
load_ctx->cb_fn(load_ctx->cb_arg, vol, 0);
|
||||
/* Only clean up the ctx - the vol has been passed to the application
|
||||
* for use now that volume load was successful.
|
||||
@ -834,6 +834,7 @@ spdk_reduce_vol_unload(struct spdk_reduce_vol *vol,
|
||||
if (--g_vol_count == 0) {
|
||||
spdk_free(g_zero_buf);
|
||||
}
|
||||
assert(g_vol_count >= 0);
|
||||
_init_load_cleanup(vol, NULL);
|
||||
cb_fn(cb_arg, 0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user