Users have been seeing failures where rbd rm is half-done; could be
because of outstanding watches on the rbd_header object. The state
is that rbd_children no longer contains the child, but other pieces
remain; remove considers this a failure.
Fix: test for ENOENT from remove_child, and treat that as an ignorable
error and drive on. Simulate this in copy.sh by removing the
rbd_children object altogether, which also results in ENOENT return
from remove_child.
Signed-off-by: Dan Mick <dan.mick@inktank.com>
Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
rados -p rbd rm rbd_id.test2
rbd rm test2
rbd ls | wc -l | grep "^0$"
+
+ # remove with rbd_children object missing (and, by extension,
+ # with child not mentioned in rbd_children)
+ rbd create --new-format -s 1 test2
+ rbd snap create test2@snap
+ rbd snap protect test2@snap
+ rbd clone test2@snap clone
+
+ rados -p rbd rm rbd_children
+ rbd rm clone
+ rbd ls | grep clone | wc -l | grep '^0$'
+
+ rbd snap unprotect test2@snap
+ rbd snap rm test2@snap
+ rbd rm test2
}
test_locking() {
if (scan_for_parents(ictx, parent_info.spec, CEPH_NOSNAP) == -ENOENT) {
r = cls_client::remove_child(&ictx->md_ctx, RBD_CHILDREN,
parent_info.spec, id);
- if (r < 0) {
+ if (r < 0 && r != -ENOENT) {
lderr(cct) << "error removing child from children list" << dendl;
return r;
}