]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
os/kstore: fix race condition
authorxie xingguo <xie.xingguo@zte.com.cn>
Fri, 5 Feb 2016 09:37:49 +0000 (17:37 +0800)
committerxie xingguo <xie.xingguo@zte.com.cn>
Fri, 5 Feb 2016 09:37:49 +0000 (17:37 +0800)
The get_omap_iterator shall check the existence of onode too,
which may race with the rename method.

Signed-off-by: xie xingguo <xie.xingguo@zte.com.cn>
src/os/kstore/KStore.cc

index 50af01eaabbbc8a1e5e9ba860048b30a8f3f1578..934c702c26c4da0604f2e3eb2bbb1947c5246abc 100644 (file)
@@ -2134,7 +2134,7 @@ ObjectMap::ObjectMapIterator KStore::get_omap_iterator(
   }
   RWLock::RLocker l(c->lock);
   OnodeRef o = c->get_onode(oid, false);
-  if (!o) {
+  if (!o || !o->exists) {
     dout(10) << __func__ << " " << oid << "doesn't exist" <<dendl;
     return ObjectMap::ObjectMapIterator();
   }