bdev: wait_for_examine during spdk_bdev_finish.
Wait for all bdevs to finish examination before proceeding with the spdk_bdev_finish shutdown logic. This ensures the bdev layer and its modules are not trying to examine bdevs after the bdev layer has reported it has shut down. Theoretically, bdev modules could all defer their fini callbacks until any outstanding examinations are complete, but it is WAY simpler to just use the existing spdK_bdev_wait_for_examine API instead. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: If90cc2a786281d348b82de8beb17ac37ba269c64 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/13850 Community-CI: Mellanox Build Bot Reviewed-by: Changpeng Liu <changpeng.liu@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
a100b4a4a4
commit
af0d907604
@ -1867,9 +1867,17 @@ spdk_bdev_module_fini_start_done(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
bdev_finish_wait_for_examine_done(void *cb_arg)
|
||||
{
|
||||
bdev_module_fini_start_iter(NULL);
|
||||
}
|
||||
|
||||
void
|
||||
spdk_bdev_finish(spdk_bdev_fini_cb cb_fn, void *cb_arg)
|
||||
{
|
||||
int rc;
|
||||
|
||||
assert(cb_fn != NULL);
|
||||
|
||||
g_fini_thread = spdk_get_thread();
|
||||
@ -1877,7 +1885,11 @@ spdk_bdev_finish(spdk_bdev_fini_cb cb_fn, void *cb_arg)
|
||||
g_fini_cb_fn = cb_fn;
|
||||
g_fini_cb_arg = cb_arg;
|
||||
|
||||
bdev_module_fini_start_iter(NULL);
|
||||
rc = spdk_bdev_wait_for_examine(bdev_finish_wait_for_examine_done, NULL);
|
||||
if (rc != 0) {
|
||||
SPDK_ERRLOG("wait_for_examine failed: %s\n", spdk_strerror(-rc));
|
||||
bdev_finish_wait_for_examine_done(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
struct spdk_bdev_io *
|
||||
|
Loading…
Reference in New Issue
Block a user