From add083e5b72dd758a319561fdc5152665a9db67f Mon Sep 17 00:00:00 2001 From: songweibin Date: Tue, 16 Jun 2020 19:57:37 +0800 Subject: [PATCH] librbd: fix potential image rm failure due to parent missing Signed-off-by: songweibin --- src/librbd/image/DetachChildRequest.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/librbd/image/DetachChildRequest.cc b/src/librbd/image/DetachChildRequest.cc index d84a0edff115f..a6fcf5a538dcb 100644 --- a/src/librbd/image/DetachChildRequest.cc +++ b/src/librbd/image/DetachChildRequest.cc @@ -73,6 +73,9 @@ void DetachChildRequest::clone_v2_child_detach() { m_parent_spec.pool_id, m_parent_spec.pool_namespace, &m_parent_io_ctx); if (r < 0) { + if (r == -ENOENT) { + r = 0; + } finish(r); return; } @@ -143,7 +146,7 @@ void DetachChildRequest::handle_clone_v2_get_snapshot(int r) { } } - if (r < 0) { + if (r < 0 && r != -ENOENT) { ldout(cct, 5) << "failed to retrieve snapshot: " << cpp_strerror(r) << dendl; } -- 2.39.5