bdev/rbd: unregitster the bdev when app exit.

Change-Id: I086fab8211c6ac71ab2eb3f5ac16f507484f79f9
Signed-off-by: Cunyin Chang <cunyin.chang@intel.com>
Reviewed-on: https://review.gerrithub.io/390088
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Cunyin Chang 2017-12-02 08:34:20 +08:00 committed by Jim Harris
parent 30dfc6d505
commit b54855f87f

View File

@ -229,6 +229,10 @@ bdev_rbd_flush(struct bdev_rbd *disk, struct spdk_io_channel *ch,
static int static int
bdev_rbd_destruct(void *ctx) bdev_rbd_destruct(void *ctx)
{ {
struct bdev_rbd *rbd = ctx;
TAILQ_REMOVE(&g_rbds, rbd, tailq);
bdev_rbd_free(rbd);
return 0; return 0;
} }
@ -468,12 +472,10 @@ static const struct spdk_bdev_fn_table rbd_fn_table = {
static void static void
bdev_rbd_library_fini(void) bdev_rbd_library_fini(void)
{ {
struct bdev_rbd *rbd; struct bdev_rbd *rbd, *btmp;
while (!TAILQ_EMPTY(&g_rbds)) { TAILQ_FOREACH_SAFE(rbd, &g_rbds, tailq, btmp) {
rbd = TAILQ_FIRST(&g_rbds); spdk_bdev_unregister(&rbd->disk, NULL, NULL);
TAILQ_REMOVE(&g_rbds, rbd, tailq);
bdev_rbd_free(rbd);
} }
} }