diff options
author | Sage Weil <sage@inktank.com> | 2013-07-14 15:54:29 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-07-15 13:47:39 -0700 |
commit | 314cf046b0b787ca69665e8751eab6fe7adb4037 (patch) | |
tree | c82382e22756a51436a0fe985d074fb2a2373d05 | |
parent | 6a524c358c9697b5b577fa6d9db01d025c084946 (diff) | |
download | ceph-314cf046b0b787ca69665e8751eab6fe7adb4037.tar.gz |
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 <sage@inktank.com>
Reviewed-by: Greg Farnum <greg@inktank.com>
-rw-r--r-- | src/messages/MClientReconnect.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/messages/MClientReconnect.h b/src/messages/MClientReconnect.h index 21f0021f31f..4e2839cab69 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) { |