From: Sage Weil Date: Thu, 26 Sep 2013 17:38:23 +0000 (-0700) Subject: osd/ReplicatedPG: fix bl resize on write vs truncate race X-Git-Tag: mark-v0.70-wip~18^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F645%2Fhead;p=ceph.git osd/ReplicatedPG: fix bl resize on write vs truncate race If we resize the write due to the funky truncate behavior, we need to resize the bufferlist to match. Fixes: #6346 Signed-off-by: Sage Weil --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 9b4d069370ba..e949c7a9b7f8 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -2645,6 +2645,9 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector& ops) op.extent.length = (op.extent.offset > oi.size ? 0 : oi.size - op.extent.offset); dout(10) << " old truncate_seq " << op.extent.truncate_seq << " < current " << seq << ", adjusting write length to " << op.extent.length << dendl; + bufferlist t; + t.substr_of(osd_op.indata, 0, op.extent.length); + osd_op.indata.swap(t); } if (op.extent.truncate_seq > seq) { // write arrives before trimtrunc