From bea74e34114e44308a70518697bc7d552e2dce9b Mon Sep 17 00:00:00 2001 From: Cyber-SiKu Date: Wed, 8 Nov 2023 17:55:47 +0800 Subject: [PATCH] [fix]curvefs/client: warmup process Fixed a bug where warm-up progress may not be added Signed-off-by: Cyber-SiKu --- curvefs/src/client/warmup/warmup_manager.cpp | 6 ++++-- curvefs/src/client/warmup/warmup_manager.h | 5 ++--- 2 files changed, 6 insertions(+), 5 deletions(-) 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..f55752c801 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; }