From: Sage Weil Date: Thu, 17 Mar 2016 21:33:53 +0000 (-0400) Subject: os/bluestore: fix off-by-one on caching tail block X-Git-Tag: v10.1.1~28^2~28 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=95a5f560936fea2e6421065001a02c87ebf9019c;p=ceph.git os/bluestore: fix off-by-one on caching tail block We can cache the tail as long as we overwrite all prior content; we don't have to extent the size. Signed-off-by: Sage Weil --- diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index ef63b9488e3ca..ca1f93d352016 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -4921,7 +4921,7 @@ void BlueStore::_pad_zeros( bl->substr_of(old, 0, *length - back_copy); bl->append(tail); *length += back_pad; - if (end > o->onode.size && g_conf->bluestore_cache_tails) { + if (end >= o->onode.size && g_conf->bluestore_cache_tails) { o->tail_bl.clear(); o->tail_bl.append(tail, 0, back_copy); o->tail_offset = end - back_copy; @@ -5002,7 +5002,7 @@ void BlueStore::_pad_zeros_tail( bl->substr_of(old, 0, *length - back_copy); bl->append(tail); *length += back_pad; - if (end > o->onode.size && g_conf->bluestore_cache_tails) { + if (end >= o->onode.size && g_conf->bluestore_cache_tails) { o->tail_bl.clear(); o->tail_bl.append(tail, 0, back_copy); o->tail_offset = end - back_copy;