From 045829d7dcb919ac8ecbc3d3d26dfd5df593d779 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 24 Jun 2016 08:56:44 -0400 Subject: [PATCH] os/bluestore: simplify and fix blob invalidation We can't invalidate based on any particular lextent we drop, as there may be other lextents (in this onode or in another one) that reference the same data. This can break even a single multi-write transaction that relies on the buffer cache to fill out blocks. Fix by just doing the unallocated version unconditionally. Signed-off-by: Sage Weil --- src/os/bluestore/BlueStore.cc | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/src/os/bluestore/BlueStore.cc b/src/os/bluestore/BlueStore.cc index 8b13695e6a5..30125306aed 100644 --- a/src/os/bluestore/BlueStore.cc +++ b/src/os/bluestore/BlueStore.cc @@ -5919,19 +5919,13 @@ void BlueStore::_wctx_finish( vector r; bool compressed = b->blob.is_compressed(); b->blob.put_ref(l.offset, l.length, min_alloc_size, &r); - if (l.blob > 0) { - // blob is owned by the onode; invalidate buffers as *we* drop - // logical refs. - b->bc.discard(l.offset, l.length); - } else { - // blob is shared. we can't invalidate our logical extents as - // we drop them because other onodes may still reference them. - // but we can throw out anything that is no longer allocated. - // Note that this will leave behind edge bits that are no - // longer referenced but not deallocated (until they age out - // of the cache naturally). - b->discard_unallocated(); - } + // we can't invalidate our logical extents as we drop them because + // other lextents (either in our onode or others) may still + // reference them. but we can throw out anything that is no + // longer allocated. Note that this will leave behind edge bits + // that are no longer referenced but not deallocated (until they + // age out of the cache naturally). + b->discard_unallocated(); txc->statfs_delta.stored() -= l.length; if (compressed) { txc->statfs_delta.compressed_original() -= l.length; -- 2.47.3