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: Jim Harris <james.r.harris@intel.com> Change-Id: I7ecd189842704bb809f25c60efa8f81dcf8ca79c Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11352 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Community-CI: Mellanox Build Bot Reviewed-by: Paul Luse <paul.e.luse@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
878bec9d73
commit
af1c4f7ffb
@ -173,8 +173,17 @@ load_next_lvol(void *cb_arg, struct spdk_blob *blob, int lvolerrno)
|
|||||||
|
|
||||||
if (lvolerrno == -ENOENT) {
|
if (lvolerrno == -ENOENT) {
|
||||||
/* Finished iterating */
|
/* 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);
|
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;
|
return;
|
||||||
} else if (lvolerrno < 0) {
|
} else if (lvolerrno < 0) {
|
||||||
SPDK_ERRLOG("Failed to fetch blobs list\n");
|
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_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:
|
invalid:
|
||||||
TAILQ_FOREACH_SAFE(lvol, &lvs->lvols, link, tmp) {
|
spdk_bs_iter_next(bs, blob, load_next_lvol, req);
|
||||||
TAILQ_REMOVE(&lvs->lvols, lvol, link);
|
|
||||||
free(lvol);
|
|
||||||
}
|
|
||||||
|
|
||||||
lvs_free(lvs);
|
|
||||||
spdk_bs_unload(bs, bs_unload_with_error_cb, req);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user