bdevperf: provide unregister callback when opening target bdev.
Bdevperf up to now didn't use unregister callback when opening target block deice. This is unsafe if test scenario involves target bdev unregistering voluntarily, although with recent bdev layer update not registering hotremove callback has become safer. To be on the safe side, this patch registers a callback to transit gone target into the I/O drain mode in case the target unregisters during runtime. Changes wrt previous versions of the patch: - incorporated review comments - updated callback functionality - updated patch description. Change-Id: I0dad2f4a7cf4acb22b363e23e4b670ca73d8c6f2 Signed-off-by: Andrey Kuzmin <akuzmin@jetstreamsoft.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/447956 Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com> Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
f9a6588f57
commit
0972838f83
@ -258,6 +258,19 @@ blockdev_heads_destroy(void)
|
||||
free(g_coremap);
|
||||
}
|
||||
|
||||
static void
|
||||
bdevperf_target_gone(void *arg)
|
||||
{
|
||||
struct io_target *target = arg;
|
||||
|
||||
spdk_poller_unregister(&target->run_timer);
|
||||
if (g_reset) {
|
||||
spdk_poller_unregister(&target->reset_timer);
|
||||
}
|
||||
|
||||
target->is_draining = true;
|
||||
}
|
||||
|
||||
static int
|
||||
bdevperf_construct_target(struct spdk_bdev *bdev)
|
||||
{
|
||||
@ -286,7 +299,7 @@ bdevperf_construct_target(struct spdk_bdev *bdev)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
rc = spdk_bdev_open(bdev, true, NULL, NULL, &target->bdev_desc);
|
||||
rc = spdk_bdev_open(bdev, true, bdevperf_target_gone, target, &target->bdev_desc);
|
||||
if (rc != 0) {
|
||||
SPDK_ERRLOG("Could not open leaf bdev %s, error=%d\n", spdk_bdev_get_name(bdev), rc);
|
||||
free(target->name);
|
||||
|
Loading…
Reference in New Issue
Block a user