]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: resurrect "exists" assert in simple_diff_cb()
authorIlya Dryomov <idryomov@gmail.com>
Fri, 10 Nov 2023 10:14:42 +0000 (11:14 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 11 Dec 2023 16:45:57 +0000 (17:45 +0100)
This effectively reverts commit 3ccc3bb4bd35 ("librbd: diff_iterate
needs to handle holes in parent images") which just dropped the assert
instead of addressing the root cause of reported crashes.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
src/librbd/api/DiffIterate.cc

index 1b6b3f72148dcc7dd9241bf94ce014cb650c4910..7679bf77759dcf8cf752cd8f4eae7f1c015c2996 100644 (file)
@@ -150,11 +150,12 @@ private:
 };
 
 int simple_diff_cb(uint64_t off, size_t len, int exists, void *arg) {
-  // 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);
-  }
+  // 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.
+  ceph_assert(exists);
+  auto diff = static_cast<interval_set<uint64_t>*>(arg);
+  diff->insert(off, len);
   return 0;
 }