From: Sage Weil Date: Tue, 20 Jan 2009 01:03:05 +0000 (-0800) Subject: objectcacher: fix object trimming X-Git-Tag: v0.6~1^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=c784a5431aaefba5769ab6f6665bc32e5772dc94;p=ceph.git objectcacher: fix object trimming Do not trim object until it fully commits. --- diff --git a/src/osdc/ObjectCacher.cc b/src/osdc/ObjectCacher.cc index 78bb3bd96298..b5ba926085be 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 34a0f1c59e48..58b6a2cb2479 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