lvol: avoid premature reference to blob
As an lvstore is being loaded, blobs are itereated with spdk_bs_iter_next(), which opens a blob, calls lvol_next_lvol(), then closes the blob. Since the blob struct that is passed to load_next_lvol() is only transiently opened, it should not be stored with the lvol. A short while later, the lvstore opens each lvol by calling spdk_lvol_open() from _vbdev_lvs_examine_cb(). At that time, the lvstore holds the open reference and only then is it safe to keep a reference to the blob. Change-Id: I309227b23b59058a58167a9dac35af5fabc29d98 Signed-off-by: Mike Gerdts <mgerdts@nvidia.com> Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14965 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Shuhei Matsumoto <smatsumoto@nvidia.com>
This commit is contained in:
parent
6d8f483383
commit
dda952809b
@ -178,7 +178,10 @@ load_next_lvol(void *cb_arg, struct spdk_blob *blob, int lvolerrno)
|
|||||||
goto invalid;
|
goto invalid;
|
||||||
}
|
}
|
||||||
|
|
||||||
lvol->blob = blob;
|
/*
|
||||||
|
* Do not store a reference to blob now because spdk_bs_iter_next() will close it.
|
||||||
|
* Storing blob_id for future lookups is fine.
|
||||||
|
*/
|
||||||
lvol->blob_id = blob_id;
|
lvol->blob_id = blob_id;
|
||||||
lvol->lvol_store = lvs;
|
lvol->lvol_store = lvs;
|
||||||
lvol->thin_provision = spdk_blob_is_thin_provisioned(blob);
|
lvol->thin_provision = spdk_blob_is_thin_provisioned(blob);
|
||||||
|
Loading…
Reference in New Issue
Block a user