Commit 9f12ec9d authored by Tomasz Zawadzki's avatar Tomasz Zawadzki Committed by Jim Harris
Browse files

lvol: remove lvol from lvol_store->lvols list once in lvol destroy



spdk_lvol_destroy() and spdk_lvol_close() behave very similar to
each other. With exception that spdk_lvol_destroy() deletes blob,
after closing the blob.

The order of calls in spdk_lvol_destroy() case:
- spdk_lvo_destroy() calls spdk_bs_md_close_blob()
- _spdk_lvol_delete_blob_cb is callback from closing the blob,
which calls spdk_bs_md_delete_blob()
- _spdk_lvol_close_blob_cb is callback from deleting the blob

The order of calls in spdk_lvol_close() case:
- spdk_lvo_close() calls spdk_bs_md_close_blob()
- _spdk_lvol_close_blob_cb is callback from closing the blob

Lvol was removed from lvol store lvol list in two cases,
spdk_lvol_destroy() and _spdk_lvol_close_blob_cb().
This caused lvol to be removed twice from the list in
lvol destroy case.

This change makes it so it is more clear, that lvol is removed
from lvol store lvol list in both cases and just once.

Signed-off-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: I204645850ca2c46f03a9035518b00f50c75e2b1a
Reviewed-on: https://review.gerrithub.io/382425


Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
parent df45eaec
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -299,8 +299,6 @@ _spdk_lvol_close_blob_cb(void *cb_arg, int lvolerrno)
		return;
	}

	TAILQ_REMOVE(&lvol->lvol_store->lvols, lvol, link);

	if (lvol->lvol_store->destruct_req && TAILQ_EMPTY(&lvol->lvol_store->lvols)) {
		spdk_lvs_unload(lvol->lvol_store, _spdk_lvs_destruct_cb, lvol->lvol_store->destruct_req);
	}
@@ -514,6 +512,7 @@ spdk_lvol_close(struct spdk_lvol *lvol)
		return;
	}

	TAILQ_REMOVE(&lvol->lvol_store->lvols, lvol, link);
	spdk_bs_md_close_blob(&(lvol->blob), _spdk_lvol_close_blob_cb, lvol);
}