]> git.baikalelectronics.ru Git - kernel.git/commit
libceph: don't add to crc unless data sent
authorAlex Elder <elder@inktank.com>
Fri, 29 Mar 2013 16:44:10 +0000 (11:44 -0500)
committerSage Weil <sage@inktank.com>
Thu, 2 May 2013 04:17:35 +0000 (21:17 -0700)
commitf06b88c18ca67d3df145e8d06b19745cd3fb2a2d
tree18c2a0f8be6ddff6abdb10f49b189c6048aabd2b
parent767d78f7f80249e99c0b9b7a4a365686f703c850
libceph: don't add to crc unless data sent

In write_partial_message_data() we aggregate the crc for the data
portion of the message as each new piece of the data item is
encountered.  Because it was computed *before* sending the data, if
an attempt to send a new piece resulted in 0 bytes being sent, the
crc crc across that piece would erroneously get computed again and
added to the aggregate result.  This would occasionally happen in
the evnet of a connection failure.

The crc value isn't really needed until the complete value is known
after sending all data, so there's no need to compute it before
sending.

So don't calculate the crc for a piece until *after* we know at
least one byte of it has been sent.  That will avoid this problem.

This resolves:
    http://tracker.ceph.com/issues/4450

Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
net/ceph/messenger.c