]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
test/rbd_mirror: "use of uninitialised value" valgrind warning 19437/head
authorMykola Golub <to.my.trociny@gmail.com>
Mon, 11 Dec 2017 20:56:40 +0000 (22:56 +0200)
committerMykola Golub <to.my.trociny@gmail.com>
Mon, 11 Dec 2017 20:56:40 +0000 (22:56 +0200)
The `on_call` context serves as a barrier and should be completed
after the `on_start_ctx` context is assigned.

The warning was observed sporadically e.g. by repeating
WaitingOnNonLeaderAcquireLeader test under valgrind.

Signed-off-by: Mykola Golub <to.my.trociny@gmail.com>
src/test/rbd_mirror/test_mock_InstanceWatcher.cc

index 69497d3918cebc18959085f1a24de43df67b1394..3cb860e6699ecc9c59a36987534cf9faa9ce07aa 100644 (file)
@@ -692,14 +692,14 @@ public:
     EXPECT_CALL(mock_image_sync_throttler, start_op(sync_id, _))
         .WillOnce(Invoke([on_call, on_start_ctx] (const std::string &,
                                                   Context *ctx) {
-                           if (on_call != nullptr) {
-                             on_call->complete(0);
-                           }
                            if (on_start_ctx != nullptr) {
                              *on_start_ctx = ctx;
                            } else {
                              ctx->complete(0);
                            }
+                           if (on_call != nullptr) {
+                             on_call->complete(0);
+                           }
                          }));
   }