]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rbd-mirror: avoid attempting to decode an empty client data buffer
authorJason Dillaman <dillaman@redhat.com>
Fri, 27 Oct 2017 20:02:20 +0000 (16:02 -0400)
committerJason Dillaman <dillaman@redhat.com>
Wed, 31 Jan 2018 16:38:38 +0000 (11:38 -0500)
Fixes: http://tracker.ceph.com/issues/21961
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 1e1d15eb0c14a6be82a6d75ab0088a6f0f4f8125)

src/tools/rbd_mirror/image_replayer/PrepareRemoteImageRequest.cc

index 35755a625a503bdb36c73cc8b49ff82924d3fc41..5fedab88a25386b28ffea335051ddc5525f5c2ba 100644 (file)
@@ -129,20 +129,18 @@ void PrepareRemoteImageRequest<I>::handle_get_client(int r) {
 
   if (r == -ENOENT) {
     dout(10) << "client not registered" << dendl;
+    register_client();
   } else if (r < 0) {
     derr << "failed to retrieve client: " << cpp_strerror(r) << dendl;
     finish(r);
-    return;
-  }
-
-  *m_client_state = m_client.state;
-  if (decode_client_meta()) {
+  } else if (!decode_client_meta()) {
+    // require operator intervention since the data is corrupt
+    finish(-EBADMSG);
+  } else {
     // skip registration if it already exists
+    *m_client_state = m_client.state;
     finish(0);
-    return;
   }
-
-  register_client();
 }
 
 template <typename I>