From: Sage Weil Date: Tue, 6 Dec 2016 19:32:52 +0000 (-0500) Subject: os/bluestore: clone_range of len 0 creates but does not size object X-Git-Tag: v11.1.1~30^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a411f58713d3f98fec53ea48dc5805529314458a;p=ceph.git os/bluestore: clone_range of len 0 creates but does not size object This mimics, roughly, open(..., O_WRONLY|O_CREAT, ...) seek(...) if (len > 0) write(...) Signed-off-by: Sage Weil --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index addc5c9bfd31..212abc4f7821 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -8751,17 +8751,19 @@ int BlueStore::_clone_range(TransContext *txc, newo->exists = true; _assign_nid(txc, newo); - if (g_conf->bluestore_clone_cow) { - _do_zero(txc, c, newo, dstoff, length); - _do_clone_range(txc, c, oldo, newo, srcoff, length, dstoff); - } else { - bufferlist bl; - r = _do_read(c.get(), oldo, srcoff, length, bl, 0); - if (r < 0) - goto out; - r = _do_write(txc, c, newo, dstoff, bl.length(), bl, 0); - if (r < 0) - goto out; + if (length > 0) { + if (g_conf->bluestore_clone_cow) { + _do_zero(txc, c, newo, dstoff, length); + _do_clone_range(txc, c, oldo, newo, srcoff, length, dstoff); + } else { + bufferlist bl; + r = _do_read(c.get(), oldo, srcoff, length, bl, 0); + if (r < 0) + goto out; + r = _do_write(txc, c, newo, dstoff, bl.length(), bl, 0); + if (r < 0) + goto out; + } } txc->write_onode(newo);