lvol: do not refer to blob when create returned error

Recent improvements to blobstore code, allow proper
reporting whenever error occured.

Callback for blob_create, should not refer to the blob
pointer when the operation failed.
Defer checking spdk_blob_get_id(blob), til after checking
error code.

This has been encountered in "vhost_boot" test:
  15:20:54	# /var/jenkins/workspace/vhost-autotest/spdk/scripts/rpc.py -s /home/sys_sgci/vhost_test/vhost/0/rpc.sock bdev_lvol_create -u d605539d-2186-486f-bc3e-745e33d37072 lvb0 20000
vhost: blobstore.c:5101: spdk_blob_get_id: Assertion `blob != NULL' failed.

https://ci.spdk.io/results/autotest-per-patch/builds/8135/archive/vhost-autotest/build.log

Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
Change-Id: Id926576e10a72e0d50fb65105be07c8ae8e40096
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1604
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
Tomasz Zawadzki 2020-03-31 09:19:14 -04:00
parent e0fb369c26
commit eb341e7d32

View File

@ -919,7 +919,6 @@ static void
_spdk_lvol_create_open_cb(void *cb_arg, struct spdk_blob *blob, int lvolerrno)
{
struct spdk_lvol_with_handle_req *req = cb_arg;
spdk_blob_id blob_id = spdk_blob_get_id(blob);
struct spdk_lvol *lvol = req->lvol;
TAILQ_REMOVE(&req->lvol->lvol_store->pending_lvols, req->lvol, link);
@ -932,7 +931,7 @@ _spdk_lvol_create_open_cb(void *cb_arg, struct spdk_blob *blob, int lvolerrno)
}
lvol->blob = blob;
lvol->blob_id = blob_id;
lvol->blob_id = spdk_blob_get_id(blob);
TAILQ_INSERT_TAIL(&lvol->lvol_store->lvols, lvol, link);