ut/bdev: dont poll threads recursively

free_bdev() polls threads to push the bdev unregister forward.
get_device_stat_test called the free_bdev() within a callback,
which results in polling threads recursively.

Discovered while working on asynchronous registration for bdevs.

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Ib4f6f50c1542d11e98f8ba093710620cca016eb4
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/5211
Community-CI: Broadcom CI
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Tomasz Zawadzki 2020-11-24 04:18:01 -05:00
parent 5338dabb73
commit c83ffe324f

View File

@ -455,7 +455,6 @@ get_device_stat_cb(struct spdk_bdev *bdev, struct spdk_bdev_io_stat *stat, void
CU_ASSERT_STRING_EQUAL(bdev_name, "bdev0");
free(stat);
free_bdev(bdev);
*(bool *)cb_arg = true;
}
@ -512,7 +511,7 @@ get_device_stat_test(void)
spdk_bdev_get_device_stat(bdev, stat, get_device_stat_cb, &done);
while (!done) { poll_threads(); }
free_bdev(bdev);
}
static void