From c6c4e3b1f1f166e090538a74ae43b74d19388ee2 Mon Sep 17 00:00:00 2001 From: Mykola Golub Date: Thu, 6 Dec 2018 21:34:56 +0200 Subject: [PATCH] librbd: corrected usage of ImageState::open flag parameter Signed-off-by: Mykola Golub --- src/librbd/api/Group.cc | 2 +- src/librbd/image/DetachChildRequest.cc | 2 +- src/librbd/image/RemoveRequest.cc | 2 +- src/test/librbd/test_fixture.cc | 2 +- src/test/librbd/test_internal.cc | 4 ++-- src/test/rbd_mirror/test_ImageDeleter.cc | 10 +++++----- src/test/rbd_mirror/test_ImageReplayer.cc | 2 +- src/test/rbd_mirror/test_PoolWatcher.cc | 2 +- src/test/rbd_mirror/test_fixture.cc | 2 +- src/tools/rbd_mirror/image_deleter/TrashMoveRequest.cc | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/librbd/api/Group.cc b/src/librbd/api/Group.cc index d1fa9b9010c62..8b75bd9480e9c 100644 --- a/src/librbd/api/Group.cc +++ b/src/librbd/api/Group.cc @@ -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); diff --git a/src/librbd/image/DetachChildRequest.cc b/src/librbd/image/DetachChildRequest.cc index da8952351f01c..89f5c949a9053 100644 --- a/src/librbd/image/DetachChildRequest.cc +++ b/src/librbd/image/DetachChildRequest.cc @@ -165,7 +165,7 @@ void DetachChildRequest::clone_v2_open_parent() { auto ctx = create_context_callback< DetachChildRequest, &DetachChildRequest::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 diff --git a/src/librbd/image/RemoveRequest.cc b/src/librbd/image/RemoveRequest.cc index d6edb2c9f5103..dad354bfd7906 100644 --- a/src/librbd/image/RemoveRequest.cc +++ b/src/librbd/image/RemoveRequest.cc @@ -95,7 +95,7 @@ void RemoveRequest::open_image() { Context *ctx = create_context_callback( this); - m_image_ctx->state->open(true, ctx); + m_image_ctx->state->open(OPEN_FLAG_SKIP_OPEN_PARENT, ctx); } template diff --git a/src/test/librbd/test_fixture.cc b/src/test/librbd/test_fixture.cc index de5741a3bb120..e9ea63d4d24a9 100644 --- a/src/test/librbd/test_fixture.cc +++ b/src/test/librbd/test_fixture.cc @@ -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, diff --git a/src/test/librbd/test_internal.cc b/src/test/librbd/test_internal.cc index c9af082724543..bee4ebd20b19b 100644 --- a/src/test/librbd/test_internal.cc +++ b/src/test/librbd/test_internal.cc @@ -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) { diff --git a/src/test/rbd_mirror/test_ImageDeleter.cc b/src/test/rbd_mirror/test_ImageDeleter.cc index d86a8822e7112..5970440d041e9 100644 --- a/src/test/rbd_mirror/test_ImageDeleter.cc +++ b/src/test/rbd_mirror/test_ImageDeleter.cc @@ -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, diff --git a/src/test/rbd_mirror/test_ImageReplayer.cc b/src/test/rbd_mirror/test_ImageReplayer.cc index a4e2f869287a1..67adc18af30e5 100644 --- a/src/test/rbd_mirror/test_ImageReplayer.cc +++ b/src/test/rbd_mirror/test_ImageReplayer.cc @@ -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; } diff --git a/src/test/rbd_mirror/test_PoolWatcher.cc b/src/test/rbd_mirror/test_PoolWatcher.cc index 46098807c4b0a..108dc355684af 100644 --- a/src/test/rbd_mirror/test_PoolWatcher.cc +++ b/src/test/rbd_mirror/test_PoolWatcher.cc @@ -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(), diff --git a/src/test/rbd_mirror/test_fixture.cc b/src/test/rbd_mirror/test_fixture.cc index 0e30a17a12529..092d41f5f651e 100644 --- a/src/test/rbd_mirror/test_fixture.cc +++ b/src/test/rbd_mirror/test_fixture.cc @@ -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, diff --git a/src/tools/rbd_mirror/image_deleter/TrashMoveRequest.cc b/src/tools/rbd_mirror/image_deleter/TrashMoveRequest.cc index ad96e2504b5b0..90a45090874f2 100644 --- a/src/tools/rbd_mirror/image_deleter/TrashMoveRequest.cc +++ b/src/tools/rbd_mirror/image_deleter/TrashMoveRequest.cc @@ -190,7 +190,7 @@ void TrashMoveRequest::open_image() { Context *ctx = create_context_callback< TrashMoveRequest, &TrashMoveRequest::handle_open_image>(this); - m_image_ctx->state->open(true, ctx); + m_image_ctx->state->open(librbd::OPEN_FLAG_SKIP_OPEN_PARENT, ctx); } template -- 2.39.5