diff --git a/curvefs/src/client/warmup/warmup_manager.cpp b/curvefs/src/client/warmup/warmup_manager.cpp index 1f7dde85cb..bcc9fb9d73 100644 --- a/curvefs/src/client/warmup/warmup_manager.cpp +++ b/curvefs/src/client/warmup/warmup_manager.cpp @@ -70,7 +70,8 @@ bool WarmupManagerS3Impl::AddWarmupFilelist(fuse_ino_t key, return false; } // add warmup Progress - if (AddWarmupProcess(key, path, type)) { + WriteLockGuard lock(inode2ProgressMutex_); + if (AddWarmupProcessLocked(key, path, type)) { LOG(INFO) << "add warmup list task:" << key; WriteLockGuard lock(warmupFilelistDequeMutex_); auto iter = FindWarmupFilelistByKeyLocked(key); @@ -96,7 +97,8 @@ bool WarmupManagerS3Impl::AddWarmupFile(fuse_ino_t key, const std::string& path, return false; } // add warmup Progress - if (AddWarmupProcess(key, path, type)) { + WriteLockGuard lock(inode2ProgressMutex_); + if (AddWarmupProcessLocked(key, path, type)) { LOG(INFO) << "add warmup single task:" << key; FetchDentryEnqueue(key, path); } diff --git a/curvefs/src/client/warmup/warmup_manager.h b/curvefs/src/client/warmup/warmup_manager.h index 5cb7342fd0..0f4f85fd4f 100644 --- a/curvefs/src/client/warmup/warmup_manager.h +++ b/curvefs/src/client/warmup/warmup_manager.h @@ -285,9 +285,8 @@ class WarmupManager { * @return true * @return false warmupProcess has been added */ - virtual bool AddWarmupProcess(fuse_ino_t key, const std::string& path, - WarmupStorageType type) { - WriteLockGuard lock(inode2ProgressMutex_); + virtual bool AddWarmupProcessLocked( + fuse_ino_t key, const std::string& path, WarmupStorageType type) { auto retPg = inode2Progress_.emplace(key, WarmupProgress(type, path)); return retPg.second; }