From d9cb0fe45cbc3c83e3f9ed8a2962591490f12e5d Mon Sep 17 00:00:00 2001 From: hmings888 <187526@qq.com> Date: Wed, 10 Jul 2024 11:18:35 +0800 Subject: [PATCH] fix bug in process closefile function which may cause metaserver crash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit in InodeFileStore.cpp:closeFile, only use entryID to search in the global inode map, when found, the iter point to the "inode" which maybe different from the "inode" that the closeFile function input parameter. in fact, the latter "inode" maybe in the parent dir's inode map. --- meta/source/storage/InodeFileStore.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/meta/source/storage/InodeFileStore.cpp b/meta/source/storage/InodeFileStore.cpp index 1472efab..f062eba5 100644 --- a/meta/source/storage/InodeFileStore.cpp +++ b/meta/source/storage/InodeFileStore.cpp @@ -209,6 +209,10 @@ bool InodeFileStore::closeFile(EntryInfo* entryInfo, FileInode* inode, unsigned if(iter != this->inodes.end() ) { // outInode exists + FileInodeReferencer* inodeRefer = iter->second; + if(inodeRefer->getReferencedObject() != inode) + return false; + *outNumHardlinks = inode->getNumHardlinks(); // Store inode information on disk, they have been set with inode->setDynAttribs() before