dev/crypto: unregister IO device on vbdev delete

The io device was previously not being unregistered, this looks
like the root cause to several recent CI failures in the bdev
JSON tests that use RPC to create/save/clear/load configs.

Change-Id: Ia77ed9fe230c79188d8d862e98b17581ae81b31f
Signed-off-by: paul luse <paul.e.luse@intel.com>
Reviewed-on: https://review.gerrithub.io/433194
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
paul luse 2018-11-13 14:44:44 -07:00 committed by Jim Harris
parent 61385feeac
commit 197998ede3

View File

@ -974,6 +974,19 @@ vbdev_crypto_io_type_supported(void *ctx, enum spdk_bdev_io_type io_type)
}
}
/* Callback for unregistering the IO device. */
static void
_device_unregister_cb(void *io_device)
{
struct vbdev_crypto *crypto_bdev = io_device;
/* Done with this crypto_bdev. */
free(crypto_bdev->drv_name);
free(crypto_bdev->key);
free(crypto_bdev->crypto_bdev.name);
free(crypto_bdev);
}
/* Called after we've unregistered following a hot remove callback.
* Our finish entry point will be called next.
*/
@ -982,18 +995,18 @@ vbdev_crypto_destruct(void *ctx)
{
struct vbdev_crypto *crypto_bdev = (struct vbdev_crypto *)ctx;
/* Remove this device from the internal list */
TAILQ_REMOVE(&g_vbdev_crypto, crypto_bdev, link);
/* Unclaim the underlying bdev. */
spdk_bdev_module_release_bdev(crypto_bdev->base_bdev);
/* Close the underlying bdev. */
spdk_bdev_close(crypto_bdev->base_desc);
/* Done with this crypto_bdev. */
TAILQ_REMOVE(&g_vbdev_crypto, crypto_bdev, link);
free(crypto_bdev->drv_name);
free(crypto_bdev->key);
free(crypto_bdev->crypto_bdev.name);
free(crypto_bdev);
/* Unregister the io_device. */
spdk_io_device_unregister(crypto_bdev, _device_unregister_cb);
return 0;
}
@ -1532,6 +1545,7 @@ delete_crypto_disk(struct spdk_bdev *bdev, spdk_delete_crypto_complete cb_fn,
}
}
/* Additional cleanup happens in the destruct callback. */
spdk_bdev_unregister(bdev, cb_fn, cb_arg);
}