blobstore: release same cluster as claimed during initial insert
When new writes come from different threads, cluster allocations can happen many times at once. The corresponding cluster number for the map is determined via _spdk_bs_allocate_cluster() and kept in ctx->new_cluster. The cluster itself is inserted into the map only on md_thread. When there is conflict of two threads allocating same cluster, message is returned to the losting thread to release the cluster. Before this patch, on such failure the cluster to release was calcualted from the page. This resulted in releasing the cluster claim for thread that actually won it. This patch makes it so that cluster allocated and save in ctx is used instead. Change-Id: Id10811b887f673f9b89e41e0637d4422f1d7270d Signed-off-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452625 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
e600f09676
commit
fde382d1ee
@ -1589,17 +1589,13 @@ _spdk_blob_insert_cluster_cpl(void *cb_arg, int bserrno)
|
||||
struct spdk_blob_copy_cluster_ctx *ctx = cb_arg;
|
||||
|
||||
if (bserrno) {
|
||||
uint32_t cluster_number;
|
||||
|
||||
if (bserrno == -EEXIST) {
|
||||
/* The metadata insert failed because another thread
|
||||
* allocated the cluster first. Free our cluster
|
||||
* but continue without error. */
|
||||
bserrno = 0;
|
||||
}
|
||||
|
||||
cluster_number = _spdk_bs_page_to_cluster(ctx->blob->bs, ctx->page);
|
||||
_spdk_bs_release_cluster(ctx->blob->bs, cluster_number);
|
||||
_spdk_bs_release_cluster(ctx->blob->bs, ctx->new_cluster);
|
||||
}
|
||||
|
||||
spdk_bs_sequence_finish(ctx->seq, bserrno);
|
||||
|
Loading…
x
Reference in New Issue
Block a user