]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: deep-copy object copy should delay computing object existence
authorJason Dillaman <dillaman@redhat.com>
Fri, 29 Mar 2019 20:33:21 +0000 (16:33 -0400)
committerJason Dillaman <dillaman@redhat.com>
Wed, 15 May 2019 20:05:10 +0000 (16:05 -0400)
This prevent a potential recursive lock on the destination image's
snap_lock.

Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 0c37066797737cd7c677b2649dae1e6422869afb)

src/librbd/deep_copy/ObjectCopyRequest.cc
src/test/librbd/deep_copy/test_mock_ObjectCopyRequest.cc

index 2f1332cdcae5a8cdee8c117c67d5725f73033c2c..0546186208ed6d9c7b7559f98cac1b453aaf5d49 100644 (file)
@@ -59,7 +59,6 @@ ObjectCopyRequest<I>::ObjectCopyRequest(I *src_image_ctx,
   ldout(m_cct, 20) << "dst_oid=" << m_dst_oid << dendl;
 
   compute_src_object_extents();
-  compute_dst_object_may_exist();
 }
 
 template <typename I>
@@ -280,6 +279,7 @@ void ObjectCopyRequest<I>::handle_read_from_parent(int r) {
     merge_write_ops();
   }
 
+  compute_dst_object_may_exist();
   compute_zero_ops();
 
   if (m_write_ops.empty()) {
index 73be5c2fe8e8e34fd86071112237041cbac468c8..6119f7b385bfd087840ea63af9224f6378af4496 100644 (file)
@@ -207,7 +207,6 @@ public:
       librbd::MockTestImageCtx &mock_src_image_ctx,
       librbd::MockTestImageCtx &mock_dst_image_ctx, Context *on_finish) {
     expect_get_object_name(mock_dst_image_ctx);
-    expect_get_object_count(mock_dst_image_ctx);
     return new MockObjectCopyRequest(&mock_src_image_ctx, &mock_dst_image_ctx,
                                      m_snap_map, 0, false, on_finish);
   }
@@ -453,6 +452,7 @@ TEST_F(TestMockDeepCopyObjectCopyRequest, DNE) {
   librbd::MockObjectMap mock_object_map;
   mock_dst_image_ctx.object_map = &mock_object_map;
   expect_test_features(mock_dst_image_ctx);
+  expect_get_object_count(mock_dst_image_ctx);
 
   C_SaferCond ctx;
   MockObjectCopyRequest *request = create_request(mock_src_image_ctx,
@@ -484,6 +484,7 @@ TEST_F(TestMockDeepCopyObjectCopyRequest, Write) {
   mock_dst_image_ctx.object_map = &mock_object_map;
 
   expect_test_features(mock_dst_image_ctx);
+  expect_get_object_count(mock_dst_image_ctx);
 
   C_SaferCond ctx;
   MockObjectCopyRequest *request = create_request(mock_src_image_ctx,
@@ -529,6 +530,7 @@ TEST_F(TestMockDeepCopyObjectCopyRequest, ReadMissingStaleSnapSet) {
   mock_dst_image_ctx.object_map = &mock_object_map;
 
   expect_test_features(mock_dst_image_ctx);
+  expect_get_object_count(mock_dst_image_ctx);
 
   C_SaferCond ctx;
   MockObjectCopyRequest *request = create_request(mock_src_image_ctx,
@@ -661,6 +663,7 @@ TEST_F(TestMockDeepCopyObjectCopyRequest, WriteError) {
   mock_dst_image_ctx.object_map = &mock_object_map;
 
   expect_test_features(mock_dst_image_ctx);
+  expect_get_object_count(mock_dst_image_ctx);
 
   C_SaferCond ctx;
   MockObjectCopyRequest *request = create_request(mock_src_image_ctx,
@@ -709,6 +712,7 @@ TEST_F(TestMockDeepCopyObjectCopyRequest, WriteSnaps) {
   mock_dst_image_ctx.object_map = &mock_object_map;
 
   expect_test_features(mock_dst_image_ctx);
+  expect_get_object_count(mock_dst_image_ctx);
 
   C_SaferCond ctx;
   MockObjectCopyRequest *request = create_request(mock_src_image_ctx,
@@ -773,6 +777,7 @@ TEST_F(TestMockDeepCopyObjectCopyRequest, Trim) {
   mock_dst_image_ctx.object_map = &mock_object_map;
 
   expect_test_features(mock_dst_image_ctx);
+  expect_get_object_count(mock_dst_image_ctx);
 
   C_SaferCond ctx;
   MockObjectCopyRequest *request = create_request(mock_src_image_ctx,
@@ -825,6 +830,7 @@ TEST_F(TestMockDeepCopyObjectCopyRequest, Remove) {
   mock_dst_image_ctx.object_map = &mock_object_map;
 
   expect_test_features(mock_dst_image_ctx);
+  expect_get_object_count(mock_dst_image_ctx);
 
   C_SaferCond ctx;
   MockObjectCopyRequest *request = create_request(mock_src_image_ctx,
@@ -875,6 +881,7 @@ TEST_F(TestMockDeepCopyObjectCopyRequest, ObjectMapUpdateError) {
   mock_dst_image_ctx.object_map = &mock_object_map;
 
   expect_test_features(mock_dst_image_ctx);
+  expect_get_object_count(mock_dst_image_ctx);
 
   C_SaferCond ctx;
   MockObjectCopyRequest *request = create_request(mock_src_image_ctx,