From 5d5e4200e2f732f67215c2df2c18e9a4371ffceb Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Fri, 5 Feb 2016 17:37:49 +0800 Subject: [PATCH] os/kstore: fix race condition The get_omap_iterator shall check the existence of onode too, which may race with the rename method. Signed-off-by: xie xingguo --- src/os/kstore/KStore.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/os/kstore/KStore.cc b/src/os/kstore/KStore.cc index 50af01eaabbbc..934c702c26c4d 100644 --- a/src/os/kstore/KStore.cc +++ b/src/os/kstore/KStore.cc @@ -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" <