]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: corrected usage of ImageState::open flag parameter 25428/head
authorMykola Golub <mgolub@suse.com>
Thu, 6 Dec 2018 19:34:56 +0000 (21:34 +0200)
committerMykola Golub <mgolub@suse.com>
Thu, 6 Dec 2018 19:48:58 +0000 (21:48 +0200)
Signed-off-by: Mykola Golub <mgolub@suse.com>
src/librbd/api/Group.cc
src/librbd/image/DetachChildRequest.cc
src/librbd/image/RemoveRequest.cc
src/test/librbd/test_fixture.cc
src/test/librbd/test_internal.cc
src/test/rbd_mirror/test_ImageDeleter.cc
src/test/rbd_mirror/test_ImageReplayer.cc
src/test/rbd_mirror/test_PoolWatcher.cc
src/test/rbd_mirror/test_fixture.cc
src/tools/rbd_mirror/image_deleter/TrashMoveRequest.cc

index d1fa9b9010c628cae2a04b9d763b95074f9f16bc..8b75bd9480e9cd3f3830124c3517eb8b9d8bd4ca 100644 (file)
@@ -340,7 +340,7 @@ int group_snap_rollback_by_record(librados::IoCtx& group_ioctx,
 
     C_SaferCond* on_finish = new C_SaferCond;
 
-    image_ctx->state->open(false, on_finish);
+    image_ctx->state->open(0, on_finish);
 
     ictxs.push_back(image_ctx);
     on_finishes.push_back(on_finish);
index da8952351f01cc3b120d7c219117c8951a9b922d..89f5c949a90534b3d6eeedd7b146894d21e5a264 100644 (file)
@@ -165,7 +165,7 @@ void DetachChildRequest<I>::clone_v2_open_parent() {
   auto ctx = create_context_callback<
     DetachChildRequest<I>,
     &DetachChildRequest<I>::handle_clone_v2_open_parent>(this);
-  m_parent_image_ctx->state->open(true, ctx);
+  m_parent_image_ctx->state->open(OPEN_FLAG_SKIP_OPEN_PARENT, ctx);
 }
 
 template<typename I>
index d6edb2c9f51032d692fac8a74e4b7168ba9b9360..dad354bfd790694f1eec20243fbc5bb3fdc000d7 100644 (file)
@@ -95,7 +95,7 @@ void RemoveRequest<I>::open_image() {
   Context *ctx = create_context_callback<klass, &klass::handle_open_image>(
     this);
 
-  m_image_ctx->state->open(true, ctx);
+  m_image_ctx->state->open(OPEN_FLAG_SKIP_OPEN_PARENT, ctx);
 }
 
 template<typename I>
index de5741a3bb12044031b33777ca0d0a2ded2faad9..e9ea63d4d24a9b717aa6c6c9d19e3a6cf3018d7f 100644 (file)
@@ -80,7 +80,7 @@ int TestFixture::open_image(const std::string &image_name,
   *ictx = new librbd::ImageCtx(image_name.c_str(), "", nullptr, m_ioctx, false);
   m_ictxs.insert(*ictx);
 
-  return (*ictx)->state->open(false);
+  return (*ictx)->state->open(0);
 }
 
 int TestFixture::snap_create(librbd::ImageCtx &ictx,
index c9af08272454349f6daad229eb99e06e4d05b7f5..bee4ebd20b19bf55704d4cb5408e860f0fe0222e 100644 (file)
@@ -139,7 +139,7 @@ TEST_F(TestInternal, OpenByID) {
    close_image(ictx);
 
    ictx = new librbd::ImageCtx("", id, nullptr, m_ioctx, true);
-   ASSERT_EQ(0, ictx->state->open(false));
+   ASSERT_EQ(0, ictx->state->open(0));
    ASSERT_EQ(ictx->name, m_image_name);
    close_image(ictx);
 }
@@ -149,7 +149,7 @@ TEST_F(TestInternal, OpenSnapDNE) {
    ASSERT_EQ(0, open_image(m_image_name, &ictx));
 
    ictx = new librbd::ImageCtx(m_image_name, "", "unknown_snap", m_ioctx, true);
-   ASSERT_EQ(-ENOENT, ictx->state->open(true));
+   ASSERT_EQ(-ENOENT, ictx->state->open(librbd::OPEN_FLAG_SKIP_OPEN_PARENT));
 }
 
 TEST_F(TestInternal, IsExclusiveLockOwner) {
index d86a8822e7112f81e1ba79cf5d237eab9a00b802..5970440d041e9bd25758ace725117af9ebede603 100644 (file)
@@ -123,7 +123,7 @@ public:
     if (!ictx) {
       ictx = new ImageCtx("", m_local_image_id, "", m_local_io_ctx,
                           false);
-      r = ictx->state->open(false);
+      r = ictx->state->open(0);
       close = (r == 0);
     }
 
@@ -144,7 +144,7 @@ public:
     if (!ictx) {
       ictx = new ImageCtx("", m_local_image_id, "", m_local_io_ctx,
                           false);
-      EXPECT_EQ(0, ictx->state->open(false));
+      EXPECT_EQ(0, ictx->state->open(0));
       close = true;
     }
 
@@ -158,7 +158,7 @@ public:
   void create_snapshot(std::string snap_name="snap1", bool protect=false) {
     ImageCtx *ictx = new ImageCtx("", m_local_image_id, "", m_local_io_ctx,
                                   false);
-    EXPECT_EQ(0, ictx->state->open(false));
+    EXPECT_EQ(0, ictx->state->open(0));
     {
       RWLock::WLocker snap_locker(ictx->snap_lock);
       ictx->set_journal_policy(new librbd::journal::DisabledPolicy());
@@ -178,7 +178,7 @@ public:
   std::string create_clone() {
     ImageCtx *ictx = new ImageCtx("", m_local_image_id, "", m_local_io_ctx,
                                   false);
-    EXPECT_EQ(0, ictx->state->open(false));
+    EXPECT_EQ(0, ictx->state->open(0));
     {
       RWLock::WLocker snap_locker(ictx->snap_lock);
       ictx->set_journal_policy(new librbd::journal::DisabledPolicy());
@@ -210,7 +210,7 @@ public:
   void check_image_deleted() {
     ImageCtx *ictx = new ImageCtx("", m_local_image_id, "", m_local_io_ctx,
                                   false);
-    EXPECT_EQ(-ENOENT, ictx->state->open(false));
+    EXPECT_EQ(-ENOENT, ictx->state->open(0));
 
     cls::rbd::MirrorImage mirror_image;
     EXPECT_EQ(-ENOENT, cls_client::mirror_image_get(&m_local_io_ctx,
index a4e2f869287a1a690ca660dc166bde4c74a7f23e..67adc18af30e577f168b1aac953f7f1ba54d6b35 100644 (file)
@@ -216,7 +216,7 @@ public:
   {
     librbd::ImageCtx *ictx = new librbd::ImageCtx(image_name.c_str(),
                                                  "", "", ioctx, readonly);
-    EXPECT_EQ(0, ictx->state->open(false));
+    EXPECT_EQ(0, ictx->state->open(0));
     *ictxp = ictx;
   }
 
index 46098807c4b0a3ef69e07be6065878a25162dcb5..108dc355684aff788d99cceaca59c56a40effa43 100644 (file)
@@ -169,7 +169,7 @@ public:
     {
       librbd::ImageCtx *ictx = new librbd::ImageCtx(parent_image_name.c_str(),
                                                    "", "", pioctx, false);
-      ictx->state->open(false);
+      ictx->state->open(0);
       EXPECT_EQ(0, ictx->operations->snap_create(cls::rbd::UserSnapshotNamespace(),
                                                 snap_name.c_str()));
       EXPECT_EQ(0, ictx->operations->snap_protect(cls::rbd::UserSnapshotNamespace(),
index 0e30a17a1252934d05c962e720ab30dfefbd2260..092d41f5f651eda9496b0ea1c3d00481fea6401c 100644 (file)
@@ -100,7 +100,7 @@ int TestFixture::open_image(librados::IoCtx &io_ctx,
   *image_ctx = new librbd::ImageCtx(image_name.c_str(), "", nullptr, io_ctx,
                                     false);
   m_image_ctxs.insert(*image_ctx);
-  return (*image_ctx)->state->open(false);
+  return (*image_ctx)->state->open(0);
 }
 
 int TestFixture::create_snap(librbd::ImageCtx *image_ctx, const char* snap_name,
index ad96e2504b5b040e70676184f5c6b5ecf8f35903..90a45090874f22e019d05acb64d9c6f484113479 100644 (file)
@@ -190,7 +190,7 @@ void TrashMoveRequest<I>::open_image() {
 
   Context *ctx = create_context_callback<
     TrashMoveRequest<I>, &TrashMoveRequest<I>::handle_open_image>(this);
-  m_image_ctx->state->open(true, ctx);
+  m_image_ctx->state->open(librbd::OPEN_FLAG_SKIP_OPEN_PARENT, ctx);
 }
 
 template <typename I>