From 6ff6f6d6f8fa6891737ed8b4e194dd1d3918c927 Mon Sep 17 00:00:00 2001 From: Jim Harris Date: Fri, 22 Feb 2019 05:23:35 -0700 Subject: [PATCH] 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 Change-Id: I3fb3368ccfe0580f0c505285d4b1e9aca797b6a6 Reviewed-on: https://review.gerrithub.io/c/445941 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto Reviewed-by: Ziye Yang Reviewed-by: Darek Stojaczyk --- lib/blob/request.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/blob/request.c b/lib/blob/request.c index b66fa7659..cfeac7fab 100644 --- a/lib/blob/request.c +++ b/lib/blob/request.c @@ -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: