]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
messages/MClientReconnect: clear data when encoding
authorSage Weil <sage@inktank.com>
Sun, 14 Jul 2013 22:54:29 +0000 (15:54 -0700)
committerSage Weil <sage@inktank.com>
Mon, 15 Jul 2013 20:47:39 +0000 (13:47 -0700)
The MClientReconnect puts everything in the data payload portion of
the message and nothing in the front portion.  That means that if the
message is resent (socket failure or something), the messenger thinks it
hasn't been encoded yet (front empty) and reencodes, which means
everything gets added (again) to the data portion.

Decoding keep decoding until it runs out of data, so the second copy
means we decode garbage snap realms, leading to the crash in bug

Clearing data each time around resolves the problem, although it does
mean we do the encoding work multiple times.  We could alternatively
(or also) stick some data in the front portion of the payload
(ignored), but that changes the wire protocol and I would rather not
do that.

Fixes: #4565
Backport: cuttlefish
Signed-off-by: Sage Weil <sage@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
src/messages/MClientReconnect.h

index 21f0021f31f41abb9cfd1aaf5e3d85147788d0fc..4e2839cab695ab90b65b189f6fb4fa135ecc899b 100644 (file)
@@ -53,6 +53,7 @@ public:
   }
 
   void encode_payload(uint64_t features) {
+    data.clear();
     if (features & CEPH_FEATURE_MDSENC) {
       ::encode(caps, data);
     } else if (features & CEPH_FEATURE_FLOCK) {