From c784a5431aaefba5769ab6f6665bc32e5772dc94 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 19 Jan 2009 17:03:05 -0800 Subject: [PATCH] objectcacher: fix object trimming Do not trim object until it fully commits. --- src/osdc/ObjectCacher.cc | 11 +++++++---- src/osdc/ObjectCacher.h | 3 ++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/osdc/ObjectCacher.cc b/src/osdc/ObjectCacher.cc index 78bb3bd96298e..b5ba926085be9 100644 --- a/src/osdc/ObjectCacher.cc +++ b/src/osdc/ObjectCacher.cc @@ -674,10 +674,13 @@ void ObjectCacher::bh_write_commit(object_t oid, loff_t start, size_t length, ti if (commit_set_callback && ob->last_commit_tid == ob->last_write_tid) { ob->uncommitted_item.remove_myself(); - if (uncommitted_by_ino[ob->get_ino()].empty()) { // no uncommitted in flight - uncommitted_by_ino.erase(ob->get_ino()); - if (dirty_tx_by_ino[ob->get_ino()] == 0) // AND nothing dirty/tx - commit_set_callback(flush_set_callback_arg, ob->get_ino()); + inodeno_t ino = ob->get_ino(); + if (ob->can_close()) + close_object(ob); + if (uncommitted_by_ino[ino].empty()) { // no uncommitted in flight + uncommitted_by_ino.erase(ino); + if (dirty_tx_by_ino[ino] == 0) // AND nothing dirty/tx + commit_set_callback(flush_set_callback_arg, ino); } } } diff --git a/src/osdc/ObjectCacher.h b/src/osdc/ObjectCacher.h index 34a0f1c59e485..58b6a2cb2479d 100644 --- a/src/osdc/ObjectCacher.h +++ b/src/osdc/ObjectCacher.h @@ -181,7 +181,8 @@ class ObjectCacher { bool can_close() { return data.empty() && lock_state == LOCK_NONE && waitfor_ack.empty() && waitfor_commit.empty() && - waitfor_rd.empty() && waitfor_wr.empty(); + waitfor_rd.empty() && waitfor_wr.empty() && + !uncommitted_item.is_on_xlist(); } // bh -- 2.39.5