From 8b25bfce7a4d80552f1a40aa9bd2e6135cffeeef Mon Sep 17 00:00:00 2001 From: Alexey Marchuk Date: Wed, 2 Feb 2022 14:30:52 +0300 Subject: [PATCH] blob: Destroy snapshot's back_bs_dev during initialization When snapshot is created, the new blob is loaded and examined for BLOB_SNAPSHOT xattr in blob_load_backing_dev function. At this step there is no such xattr, so zeroes back_bs_dev is created. Later snapshot inherits back_bs_dev from original blob, so previously created back_bs_dev can be lost. Signed-off-by: Alexey Marchuk Change-Id: I90cc9b02f56598d8c5c7fe00409f571fba0aa91a Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/11384 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Shuhei Matsumoto Community-CI: Mellanox Build Bot Community-CI: Broadcom CI --- lib/blob/blobstore.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/blob/blobstore.c b/lib/blob/blobstore.c index 6ed950b6a..e43b5300d 100644 --- a/lib/blob/blobstore.c +++ b/lib/blob/blobstore.c @@ -6001,6 +6001,9 @@ bs_snapshot_freeze_cpl(void *cb_arg, int rc) ctx->frozen = true; + if (newblob->back_bs_dev) { + newblob->back_bs_dev->destroy(newblob->back_bs_dev); + } /* set new back_bs_dev for snapshot */ newblob->back_bs_dev = origblob->back_bs_dev; /* Set invalid flags from origblob */