Do not recreate passthru vbdev unnecessarily.
The passthru module associates a vbdev and the underlying bdev. This association lives throughout the lifetime of the module and because of this, passthru vbdevs are recreated when they shouldn't be. This patch ensures that the association between a vbdev and a bdev is broken when the vbdev is removed, so that if the underlying bdev is ever recreated (after being deleted), the vbdev does not reappear. Note that this change does not affect hot-remove operations. Change-Id: I5cb4cf7efcb5e5eeaeef79849e0aaefec4684a4f Signed-off-by: Wael Halbawi <waelhalbawi@gmail.com> Reviewed-on: https://review.gerrithub.io/422474 Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Chandler-Test-Pool: SPDK Automated Test System <sys_sgsw@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
parent
e9424c7e1c
commit
5abf2ecfcd
@ -572,11 +572,27 @@ create_passthru_disk(const char *bdev_name, const char *vbdev_name)
|
||||
void
|
||||
delete_passthru_disk(struct spdk_bdev *bdev, spdk_delete_passthru_complete cb_fn, void *cb_arg)
|
||||
{
|
||||
struct bdev_names *name;
|
||||
|
||||
if (!bdev || bdev->module != &passthru_if) {
|
||||
cb_fn(cb_arg, -ENODEV);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Remove the association (vbdev, bdev) from g_bdev_names. This is required so that the
|
||||
* vbdev does not get re-created if the same bdev is constructed at some other time,
|
||||
* unless the underlying bdev was hot-removed.
|
||||
*/
|
||||
TAILQ_FOREACH(name, &g_bdev_names, link) {
|
||||
if (strcmp(name->vbdev_name, bdev->name) == 0) {
|
||||
TAILQ_REMOVE(&g_bdev_names, name, link);
|
||||
free(name->bdev_name);
|
||||
free(name->vbdev_name);
|
||||
free(name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
spdk_bdev_unregister(bdev, cb_fn, cb_arg);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user