From: Sage Weil Date: Sun, 14 Jul 2013 22:54:29 +0000 (-0700) Subject: messages/MClientReconnect: clear data when encoding X-Git-Tag: v0.67-rc1~77 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=314cf046b0b787ca69665e8751eab6fe7adb4037;p=ceph.git messages/MClientReconnect: clear data when encoding 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 Reviewed-by: Greg Farnum --- diff --git a/src/messages/MClientReconnect.h b/src/messages/MClientReconnect.h index 21f0021f31f4..4e2839cab695 100644 --- a/src/messages/MClientReconnect.h +++ b/src/messages/MClientReconnect.h @@ -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) {