]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: failed assertion after shrinking a clone image twice 10072/head
authorJason Dillaman <dillaman@redhat.com>
Thu, 30 Jun 2016 19:00:32 +0000 (15:00 -0400)
committerJason Dillaman <dillaman@redhat.com>
Thu, 30 Jun 2016 19:00:32 +0000 (15:00 -0400)
Fixes: http://tracker.ceph.com/issues/16561
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
src/librbd/ImageCtx.cc
src/librbd/ImageCtx.h
src/librbd/operation/TrimRequest.cc
src/test/librbd/test_internal.cc

index 90a20d3250c9fc207286b984e67bd20d85d5193a..03a1e775e74efeb300560d3f889bdf4f52d96a6c 100644 (file)
@@ -663,17 +663,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 2174392f00f6e942256d2cf23ae7a77044747baa..f72d7ea68c98cbc3fca958f19e693b44d55576c8 100644 (file)
@@ -256,7 +256,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 d1d8dc804d46ca0dcea9584c641a9574bb213e57..58266a4c28fd7179509ff0497c6400229537fdf8 100644 (file)
@@ -194,8 +194,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"));
 
   {