From: Samuel Just Date: Thu, 12 Jan 2012 21:13:47 +0000 (-0800) Subject: ReplicatedPG: Do a write even for 0 length operation X-Git-Tag: v0.40~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=845aa534e3e0ddc4f652879c473f011fff9c573b;p=ceph.git ReplicatedPG: Do a write even for 0 length operation Otherwise, a 0 length write to an offset past the end of the file will cause the internal accounting to reflect the full size of the file, but not the file on disk. Signed-off-by: Samuel Just --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index c015ae0511b22..120592c97fc84 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -1618,13 +1618,9 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector& ops, oi.truncate_seq = op.extent.truncate_seq; oi.truncate_size = op.extent.truncate_size; } - if (op.extent.length) { - bufferlist nbl; - bp.copy(op.extent.length, nbl); - t.write(coll, soid, op.extent.offset, op.extent.length, nbl); - } else { - t.touch(coll, soid); - } + bufferlist nbl; + bp.copy(op.extent.length, nbl); + t.write(coll, soid, op.extent.offset, op.extent.length, nbl); write_update_size_and_usage(ctx->delta_stats, oi, ssc->snapset, ctx->modified_ranges, op.extent.offset, op.extent.length, true); if (!obs.exists) {