diff options
author | Sage Weil <sage@inktank.com> | 2013-09-26 10:38:23 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-09-26 10:38:23 -0700 |
commit | 179001b42c142e0877e6c4991f88e7355c9b82ff (patch) | |
tree | d8b556858e774d16abb84ad05d8f2f1bbf0652e0 | |
parent | 1d67aeba729013638ad1d853ab6f23f6e1f6bb26 (diff) | |
download | ceph-179001b42c142e0877e6c4991f88e7355c9b82ff.tar.gz |
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 <sage@inktank.com>
-rw-r--r-- | src/osd/ReplicatedPG.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 9b4d069370b..e949c7a9b7f 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -2645,6 +2645,9 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& 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 |