Commit af1c4f7f authored by Jim Harris's avatar Jim Harris
Browse files

lvol: finish initial iteration even if blob has no name



If we find a blob during the initial iteration during load
that doesn't have a name, we cannot just immediately
unload the blobstore, since the 'bad' blob is still
open.  Instead finish the iteration, and unload the
blobstore (with failure status) after the iteration
is complete.

This is somewhat related to issue #1831. By ensuring
we can unload the blobstore, it closes the open
descriptor on the underlying bdev, which allows
the bdev subsystem to exit on application shutdown.

Signed-off-by: default avatarJim Harris <james.r.harris@intel.com>
Change-Id: I7ecd189842704bb809f25c60efa8f81dcf8ca79c
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11352


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent 878bec9d
Loading
Loading
Loading
Loading
+12 −13
Original line number Diff line number Diff line
@@ -173,8 +173,17 @@ load_next_lvol(void *cb_arg, struct spdk_blob *blob, int lvolerrno)

	if (lvolerrno == -ENOENT) {
		/* Finished iterating */
		req->cb_fn(req->cb_arg, lvs, 0);
		if (req->lvserrno == 0) {
			req->cb_fn(req->cb_arg, lvs, req->lvserrno);
			free(req);
		} else {
			TAILQ_FOREACH_SAFE(lvol, &lvs->lvols, link, tmp) {
				TAILQ_REMOVE(&lvs->lvols, lvol, link);
				free(lvol);
			}
			lvs_free(lvs);
			spdk_bs_unload(bs, bs_unload_with_error_cb, req);
		}
		return;
	} else if (lvolerrno < 0) {
		SPDK_ERRLOG("Failed to fetch blobs list\n");
@@ -235,18 +244,8 @@ load_next_lvol(void *cb_arg, struct spdk_blob *blob, int lvolerrno)

	SPDK_INFOLOG(lvol, "added lvol %s (%s)\n", lvol->unique_id, lvol->uuid_str);

	spdk_bs_iter_next(bs, blob, load_next_lvol, req);

	return;

invalid:
	TAILQ_FOREACH_SAFE(lvol, &lvs->lvols, link, tmp) {
		TAILQ_REMOVE(&lvs->lvols, lvol, link);
		free(lvol);
	}

	lvs_free(lvs);
	spdk_bs_unload(bs, bs_unload_with_error_cb, req);
	spdk_bs_iter_next(bs, blob, load_next_lvol, req);
}

static void