]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: diff_iterate needs to handle holes in parent images
authorJason Dillaman <dillaman@redhat.com>
Tue, 8 Sep 2015 19:47:37 +0000 (15:47 -0400)
committerJason Dillaman <dillaman@redhat.com>
Mon, 28 Sep 2015 14:28:22 +0000 (10:28 -0400)
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 <dillaman@redhat.com>
(cherry picked from commit 3ccc3bb4bd35e57209852d460633e371b4d004e2)

 Conflicts:
src/librbd/DiffIterate.cc : file doesn't exist in hammer, logic is in internal.cc

src/librbd/internal.cc

index 447e9d00cd5c7b08f7892accceb4a91cbf6e3570..27832caf1cfdb4a0f9be4a89c7794da5feaf07d3 100644 (file)
@@ -2824,12 +2824,12 @@ reprotect_and_return_err:
 
   int 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<uint64_t> *diff = static_cast<interval_set<uint64_t> *>(arg);
-    diff->insert(off, len);
+    // it's possible for a discard to create a hole in the parent image --
+    // ignore
+    if (exists) {
+      interval_set<uint64_t> *diff = static_cast<interval_set<uint64_t> *>(arg);
+      diff->insert(off, len);
+    }
     return 0;
   }