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 (master)
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/447449
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Jim Harris 2019-02-22 05:23:35 -07:00
parent 85d6682dd4
commit cf0d953044

View File

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