]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix CInode::get_approx_dirfrag
authorYan, Zheng <zheng.z.yan@intel.com>
Fri, 21 Mar 2014 23:38:22 +0000 (07:38 +0800)
committerYan, Zheng <zheng.z.yan@intel.com>
Fri, 28 Mar 2014 18:08:13 +0000 (02:08 +0800)
return NULL if there is no opened dirfrag

Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
src/mds/CInode.cc

index 2f66ab4acbb8120f443e3f26283a94156f41e379..e475dfb2a17674f574f4c53205441f0f1f3dd1fa 100644 (file)
@@ -534,11 +534,12 @@ CDir *CInode::get_approx_dirfrag(frag_t fg)
     return ls.front();
 
   // try parents?
-  while (1) {
+  while (fg.bits() > 0) {
     fg = fg.parent();
     dir = get_dirfrag(fg);
     if (dir) return dir;
   }
+  return NULL;
 }      
 
 void CInode::get_dirfrags(list<CDir*>& ls)