From: Jason Dillaman Date: Tue, 8 Sep 2015 19:47:37 +0000 (-0400) Subject: librbd: diff_iterate needs to handle holes in parent images X-Git-Tag: v9.1.0~183^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F5843%2Fhead;p=ceph.git librbd: diff_iterate needs to handle holes in parent images If a clone's parent image snapshot includes a discarded extent, this was previously causing an assert failure. Instead, ignore any discard holes in the parent image. Fixes: #12885 Backport: hammer Signed-off-by: Jason Dillaman --- diff --git a/src/librbd/DiffIterate.cc b/src/librbd/DiffIterate.cc index 00a9ebae2b72..311758785a1b 100644 --- a/src/librbd/DiffIterate.cc +++ b/src/librbd/DiffIterate.cc @@ -513,12 +513,11 @@ int DiffIterate::diff_object_map(uint64_t from_snap_id, uint64_t to_snap_id, int DiffIterate::simple_diff_cb(uint64_t off, size_t len, int exists, void *arg) { - // This reads the existing extents in a parent from the beginning - // of time. Since images are thin-provisioned, the extents will - // always represent data, not holes. - assert(exists); - interval_set *diff = static_cast *>(arg); - diff->insert(off, len); + // it's possible for a discard to create a hole in the parent image -- ignore + if (exists) { + interval_set *diff = static_cast *>(arg); + diff->insert(off, len); + } return 0; }