From 78c3ef90604ca117255cefe232771a7564fed8b1 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 25 Sep 2014 13:16:52 -0700 Subject: [PATCH] osdc/Objecter: only post_rx_buffer if no op timeout If we post an rx buffer and there is a timeout, the revocation can happen while the reader has consumed the buffers but before it has decoded and constructed the message. In particular, we calculate a crc32c over the data portion of the message after we've taken the buffers and dropped the lock. Instead of fixing this race (for example, by reverifying rx_buffers under the lock while calculating the crc.. bleh), just skip the rx buffer optimization entirely when a timeout is present. Note that this doesn't cover the op_cancel() paths, but none of those users provide static buffers to read into. Fixes: #9582 Backport: firefly, dumpling Signed-off-by: Sage Weil backport of 126d0b30e990519b8f845f99ba893fdcd56de447 --- src/osdc/Objecter.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index d82b3e12902ec..695979d5c0427 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -1640,7 +1640,9 @@ void Objecter::send_op(Op *op) ldout(cct, 20) << " revoking rx buffer for " << op->tid << " on " << op->con << dendl; op->con->revoke_rx_buffer(op->tid); } - if (op->outbl && op->outbl->length()) { + if (op->outbl && + op->ontimeout == NULL && // only post rx_buffer if no timeout; see #9582 + op->outbl->length()) { ldout(cct, 20) << " posting rx buffer for " << op->tid << " on " << op->session->con << dendl; op->con = op->session->con; op->con->post_rx_buffer(op->tid, *op->outbl); -- 2.39.5