From a963e51d758aac11b7b203ebd66347c7e2192596 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Tue, 22 Sep 2009 15:37:51 -0700 Subject: [PATCH] mds: fix inode load existence check We can lookup using last snapid, not first. That's how the inode_map is indexed. --- src/mds/CDir.cc | 4 ++-- src/mds/MDCache.h | 8 ++------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/mds/CDir.cc b/src/mds/CDir.cc index b491e979e51ec..58982d1faad3a 100644 --- a/src/mds/CDir.cc +++ b/src/mds/CDir.cc @@ -1225,8 +1225,8 @@ void CDir::_fetched(bufferlist &bl) } else { // add inode CInode *in = 0; - if (cache->have_inode(inode.ino, first)) { - in = cache->get_inode(inode.ino, first); + if (cache->have_inode(inode.ino, last)) { + in = cache->get_inode(inode.ino, last); dout(-12) << "_fetched got (but i already had) " << *in << " mode " << in->inode.mode << " mtime " << in->inode.mtime << dendl; diff --git a/src/mds/MDCache.h b/src/mds/MDCache.h index 9aaa9468def9b..f858ca055e5fa 100644 --- a/src/mds/MDCache.h +++ b/src/mds/MDCache.h @@ -835,6 +835,7 @@ public: return have_inode(vinodeno_t(ino, snap)); } bool have_inode(vinodeno_t vino) { return inode_map.count(vino) ? true:false; } + CInode* get_inode(vinodeno_t vino) { return get_inode(vino.ino, vino.snapid); } @@ -844,16 +845,11 @@ public: return inode_map[vino]; return NULL; } + CDir* get_dirfrag(dirfrag_t df) { if (!have_inode(df.ino)) return NULL; return get_inode(df.ino)->get_dirfrag(df.frag); } - /* - void get_dirfrags_under(dirfrag_t df, list& ls) { - if (have_inode(df.ino)) - inode_map[df.ino]->get_dirfrags_under(df.frag, ls); - } - */ MDSCacheObject *get_object(MDSCacheObjectInfo &info); -- 2.39.5