]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Fix deadlock caused by hold collection obj
authorHaomai Wang <haomaiwang@gmail.com>
Tue, 18 Feb 2014 07:04:25 +0000 (15:04 +0800)
committerHaomai Wang <haomaiwang@gmail.com>
Sat, 22 Feb 2014 13:04:59 +0000 (21:04 +0800)
Collection is a special object in KeyValueStore, if exists collection modify,
this object will be hold. When exists check collection, it will be dead lock to
try to access this object.

Now lookup transaction cache first to ensure no collection object exists
already.

Signed-off-by: Haomai Wang <haomaiwang@gmail.com>
src/os/KeyValueStore.cc

index 2d7bd3fd0f523a4cbfbec21c0f982be7228a6ee0..02fa3ee1f618d3eb1e80c0bd583ad0a7e9e1055a 100644 (file)
@@ -266,15 +266,15 @@ void KeyValueStore::SubmitManager::op_submit_finish(uint64_t op)
 
 int KeyValueStore::BufferTransaction::check_coll(const coll_t &cid)
 {
-  int r = store->_check_coll(cid);
-  if (r == 0)
-    return r;
-
   StripHeaderMap::iterator it = strip_headers.find(
       make_pair(get_coll_for_coll(), make_ghobject_for_coll(cid)));
   if (it != strip_headers.end() && !it->second.deleted) {
     return 0;
   }
+
+  if (store->_check_coll(cid) == 0)
+    return 0;
+
   return -ENOENT;
 }