blob: pass NULL or SPDK_BLOBID_INVALID when bserrno != 0

When an operation fails, we shouldn't pass a handle or
a 'valid' blob ID to the caller's completion function.
The caller *should* ignore it when bserrno != 0, but
it's best to not take that chance.

Fixes #685.

Note: #685 seems to have a broader issue related to
a possibly locked NVMe SSD in the submitter's system.
This only fixes the assert() that was hit.

Signed-off-by: Jim Harris <james.r.harris@intel.com>
Change-Id: I3fb3368ccfe0580f0c505285d4b1e9aca797b6a6

Reviewed-on: https://review.gerrithub.io/c/445941
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: Ziye Yang <ziye.yang@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
Jim Harris 2019-02-22 05:23:35 -07:00 committed by Darek Stojaczyk
parent e632df9d4f
commit 6ff6f6d6f8

View File

@ -51,7 +51,7 @@ spdk_bs_call_cpl(struct spdk_bs_cpl *cpl, int bserrno)
break;
case SPDK_BS_CPL_TYPE_BS_HANDLE:
cpl->u.bs_handle.cb_fn(cpl->u.bs_handle.cb_arg,
cpl->u.bs_handle.bs,
bserrno == 0 ? cpl->u.bs_handle.bs : NULL,
bserrno);
break;
case SPDK_BS_CPL_TYPE_BLOB_BASIC:
@ -60,12 +60,12 @@ spdk_bs_call_cpl(struct spdk_bs_cpl *cpl, int bserrno)
break;
case SPDK_BS_CPL_TYPE_BLOBID:
cpl->u.blobid.cb_fn(cpl->u.blobid.cb_arg,
cpl->u.blobid.blobid,
bserrno == 0 ? cpl->u.blobid.blobid : SPDK_BLOBID_INVALID,
bserrno);
break;
case SPDK_BS_CPL_TYPE_BLOB_HANDLE:
cpl->u.blob_handle.cb_fn(cpl->u.blob_handle.cb_arg,
cpl->u.blob_handle.blob,
bserrno == 0 ? cpl->u.blob_handle.blob : NULL,
bserrno);
break;
case SPDK_BS_CPL_TYPE_NESTED_SEQUENCE: