]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: don't crash on cache readdir of empty dir
authorSage Weil <sage@newdream.net>
Mon, 13 Sep 2010 18:31:53 +0000 (11:31 -0700)
committerSage Weil <sage@newdream.net>
Mon, 13 Sep 2010 18:31:53 +0000 (11:31 -0700)
src/client/Client.cc

index 0a0a15b4cdf4a99239ad172fcf04497e22b9e70e..67cb8a9b7cf97a667848b4a1f8d4fc12f43ceae2 100644 (file)
@@ -4029,6 +4029,12 @@ int Client::_readdir_cache_cb(DirResult *dirp, add_dirent_cb_t cb, void *p)
           << dendl;
   Dir *dir = dirp->inode->dir;
 
+  if (!dir) {
+    dout(10) << " dir is empty" << dendl;
+    dirp->set_end();
+    return 1;
+  }
+
   map<string,Dentry*>::iterator pd;
   if (dirp->at_cache_name.length()) {
     pd = dir->dentry_map.find(dirp->at_cache_name);