]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/ObjectCacher: finish contexts after dropping object reference
authorYan, Zheng <zheng.z.yan@intel.com>
Thu, 12 Sep 2013 02:36:39 +0000 (10:36 +0800)
committerSage Weil <sage@inktank.com>
Thu, 10 Oct 2013 11:26:44 +0000 (04:26 -0700)
The context to finish can be class C_Client_PutInode, which may drop
inode's last reference. So we should first drop object's reference,
then finish contexts.

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
(cherry picked from commit b66ac77fa7aa3ff37804918c4308a348f239af09)

src/osdc/ObjectCacher.cc

index 4ea9bd622d97831a5cd1e7fbc62bb2ccc95b9d7c..81d879d5006373f30cba2af55d3f9dfddfe3365d 100644 (file)
@@ -898,11 +898,10 @@ void ObjectCacher::bh_write_commit(int64_t poolid, sobject_t oid, loff_t start,
     ob->last_commit_tid = tid;
 
     // waiters?
+    list<Context*> ls;
     if (ob->waitfor_commit.count(tid)) {
-      list<Context*> ls;
       ls.splice(ls.begin(), ob->waitfor_commit[tid]);
       ob->waitfor_commit.erase(tid);
-      finish_contexts(cct, ls, r);
     }
 
     // is the entire object set now clean and fully committed?
@@ -914,6 +913,9 @@ void ObjectCacher::bh_write_commit(int64_t poolid, sobject_t oid, loff_t start,
        oset->dirty_or_tx == 0) {        // nothing dirty/tx
       flush_set_callback(flush_set_callback_arg, oset);      
     }
+
+    if (!ls.empty())
+      finish_contexts(cct, ls, r);
   }
 }