bdev/compress: fix issues with delete

I didn't test delete after making a bunch of channel changes so there
were some bugs in that path.  Also as a drive-by I NULL out the
base_desc in vbdev_reduce_load_cb() to be consistent with other places
where I'm closing the base desc.

Signed-off-by: paul luse <paul.e.luse@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452267 (master)

(cherry picked from commit 168738298b)
Change-Id: Iddd5dc704cde8eb7a6a5a3a8481e064a5c6c6d4e
Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/457228
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
paul luse 2019-04-26 16:40:18 -04:00 committed by Darek Stojaczyk
parent 38a1ebb516
commit c126086c00

View File

@ -693,6 +693,7 @@ _reduce_destroy_cb(void *ctx, int reduce_errno)
}
comp_bdev->vol = NULL;
spdk_put_io_channel(comp_bdev->base_ch);
spdk_bdev_unregister(&comp_bdev->comp_bdev, comp_bdev->delete_cb_fn,
comp_bdev->delete_cb_arg);
}
@ -703,11 +704,12 @@ delete_vol_unload_cb(void *cb_arg, int reduce_errno)
{
struct vbdev_compress *comp_bdev = (struct vbdev_compress *)cb_arg;
/* Close the underlying bdev. */
spdk_bdev_close(comp_bdev->base_desc);
if (reduce_errno) {
SPDK_ERRLOG("number %d\n", reduce_errno);
} else {
/* reducelib needs a channel to comm with the backing device */
comp_bdev->base_ch = spdk_bdev_get_io_channel(comp_bdev->base_desc);
/* Clean the device before we free our resources. */
spdk_reduce_vol_destroy(&comp_bdev->backing_dev, _reduce_destroy_cb, comp_bdev);
}
@ -1300,6 +1302,7 @@ vbdev_reduce_load_cb(void *cb_arg, struct spdk_reduce_vol *vol, int reduce_errno
/* Done with metadata operations */
spdk_put_io_channel(meta_ctx->base_ch);
spdk_bdev_close(meta_ctx->base_desc);
meta_ctx->base_desc = NULL;
if (reduce_errno != 0) {
/* This error means it is not a compress disk. */