From cd6ac726dd3332496ee42565a714ab086f3cb2f0 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Mon, 24 Aug 2015 10:58:52 -0400 Subject: [PATCH] librbd: error closing image while set to invalid snapshot With cache disabled, closing the image will result in a flush which might result in the image being refreshed. If this happens while the image is set to an invalid snapshot, an error will be returned while closing the image. Fixes: #12765 Backport: infernalis Signed-off-by: Jason Dillaman --- src/librbd/internal.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc index e1bccdc516dd5..8b9f3b9dc4573 100644 --- a/src/librbd/internal.cc +++ b/src/librbd/internal.cc @@ -2140,11 +2140,12 @@ reprotect_and_return_err: if (ictx->parent) { uint64_t overlap; r = ictx->get_parent_overlap(ictx->snap_id, &overlap); - if (r < 0) + if (r < 0 && r != -ENOENT) { return r; - if (!overlap || + } + if (r == -ENOENT || overlap == 0 || ictx->parent->md_ctx.get_id() != - ictx->get_parent_pool_id(ictx->snap_id) || + ictx->get_parent_pool_id(ictx->snap_id) || ictx->parent->id != ictx->get_parent_image_id(ictx->snap_id) || ictx->parent->snap_id != ictx->get_parent_snap_id(ictx->snap_id)) { ictx->clear_nonexistence_cache(); -- 2.39.5