]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: failed assertion after shrinking a clone image twice 10647/head
authorJason Dillaman <dillaman@redhat.com>
Thu, 30 Jun 2016 19:00:32 +0000 (15:00 -0400)
committerLoic Dachary <ldachary@redhat.com>
Wed, 10 Aug 2016 08:14:56 +0000 (10:14 +0200)
Fixes: http://tracker.ceph.com/issues/16561
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 34d2297eed040f694b4d1c5e2606af04752c9e1a)

src/librbd/ImageCtx.cc
src/librbd/ImageCtx.h
src/librbd/operation/TrimRequest.cc
src/test/librbd/test_internal.cc

index 87c710e9be4476015a7f6750e79a61a9c250bd23..18ec2a4ce3439ea9bb3be4fb4d8e21e7e94ff6b0 100644 (file)
@@ -662,17 +662,6 @@ struct C_InvalidateCache : public Context {
     return -ENOENT;
   }
 
-  uint64_t ImageCtx::get_copyup_snap_id() const
-  {
-    assert(snap_lock.is_locked());
-    // copyup requires the largest possible parent overlap,
-    // which is always the oldest snapshot (if any).
-    if (!snaps.empty()) {
-      return snaps.back();
-    }
-    return CEPH_NOSNAP;
-  }
-
   void ImageCtx::aio_read_from_cache(object_t o, uint64_t object_no,
                                     bufferlist *bl, size_t len,
                                     uint64_t off, Context *onfinish,
index 076072c7a01879e3861194c9fe0ff056425f4dbb..088937ed64370ddd7690a3fa80042910c91d11dd 100644 (file)
@@ -259,7 +259,6 @@ namespace librbd {
     uint64_t get_parent_snap_id(librados::snap_t in_snap_id) const;
     int get_parent_overlap(librados::snap_t in_snap_id,
                           uint64_t *overlap) const;
-    uint64_t get_copyup_snap_id() const;
     void aio_read_from_cache(object_t o, uint64_t object_no, bufferlist *bl,
                             size_t len, uint64_t off, Context *onfinish,
                             int fadvise_flags);
index 3ed96f792e38c9e7d40d22a71f23fbfe67a57d85..333dc86374abb329a15dd79c6fc2e09c43376063 100644 (file)
@@ -195,8 +195,7 @@ void TrimRequest<I>::send_copyup_objects() {
 
     snapc = image_ctx.snapc;
     has_snapshots = !image_ctx.snaps.empty();
-    int r = image_ctx.get_parent_overlap(image_ctx.get_copyup_snap_id(),
-                                           &parent_overlap);
+    int r = image_ctx.get_parent_overlap(CEPH_NOSNAP, &parent_overlap);
     assert(r == 0);
   }
 
index b5c6f6b1ee43808bac0f7a35c28de1648eaf4756..580d6125b8970b51189c8a209e93b69f8d8be3de 100644 (file)
@@ -601,7 +601,6 @@ TEST_F(TestInternal, ResizeCopyup)
 
   librbd::ImageCtx *ictx2;
   ASSERT_EQ(0, open_image(clone_name, &ictx2));
-
   ASSERT_EQ(0, snap_create(*ictx2, "snap1"));
 
   bufferptr read_ptr(bl.length());
@@ -612,6 +611,8 @@ TEST_F(TestInternal, ResizeCopyup)
   librbd::NoOpProgressContext no_op;
   ASSERT_EQ(0, ictx2->operations->resize(m_image_size - (1 << order) - 32,
                                          no_op));
+  ASSERT_EQ(0, ictx2->operations->resize(m_image_size - (2 << order) - 32,
+                                         no_op));
   ASSERT_EQ(0, librbd::snap_set(ictx2, "snap1"));
 
   {