From 57d2781da8ed6159397f0832935844c690033699 Mon Sep 17 00:00:00 2001 From: Jason Dillaman Date: Mon, 16 Mar 2015 18:40:49 -0400 Subject: [PATCH] librbd: snap_remove should ignore -ENOENT errors If the attempt to deregister the snapshot from the parent image fails with -ENOENT, ignore the error as it is safe to assume that the child is not associated with the parent. Fixes: #11113 Signed-off-by: Jason Dillaman (cherry picked from commit cf8094942ccdba831e03e5a79451cfa5d78a135f) --- src/librbd/internal.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc index 2651ba6208f87..c356c79fe3b5e 100644 --- a/src/librbd/internal.cc +++ b/src/librbd/internal.cc @@ -584,8 +584,11 @@ namespace librbd { (scan_for_parents(ictx, our_pspec, snap_id) == -ENOENT)) { r = cls_client::remove_child(&ictx->md_ctx, RBD_CHILDREN, our_pspec, ictx->id); - if (r < 0) + if (r < 0 && r != -ENOENT) { + lderr(ictx->cct) << "snap_remove: failed to deregister from parent " + "image" << dendl; return r; + } } } -- 2.39.5