Skip to content

Commit bea74e3

Browse files
Cyber-SiKuwuhongsong
authored andcommitted
[fix]curvefs/client: warmup process
Fixed a bug where warm-up progress may not be added Signed-off-by: Cyber-SiKu <Cyber-SiKu@outlook.com>
1 parent 80a9716 commit bea74e3

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

curvefs/src/client/warmup/warmup_manager.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ bool WarmupManagerS3Impl::AddWarmupFilelist(fuse_ino_t key,
7070
return false;
7171
}
7272
// add warmup Progress
73-
if (AddWarmupProcess(key, path, type)) {
73+
WriteLockGuard lock(inode2ProgressMutex_);
74+
if (AddWarmupProcessLocked(key, path, type)) {
7475
LOG(INFO) << "add warmup list task:" << key;
7576
WriteLockGuard lock(warmupFilelistDequeMutex_);
7677
auto iter = FindWarmupFilelistByKeyLocked(key);
@@ -96,7 +97,8 @@ bool WarmupManagerS3Impl::AddWarmupFile(fuse_ino_t key, const std::string& path,
9697
return false;
9798
}
9899
// add warmup Progress
99-
if (AddWarmupProcess(key, path, type)) {
100+
WriteLockGuard lock(inode2ProgressMutex_);
101+
if (AddWarmupProcessLocked(key, path, type)) {
100102
LOG(INFO) << "add warmup single task:" << key;
101103
FetchDentryEnqueue(key, path);
102104
}

curvefs/src/client/warmup/warmup_manager.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,8 @@ class WarmupManager {
285285
* @return true
286286
* @return false warmupProcess has been added
287287
*/
288-
virtual bool AddWarmupProcess(fuse_ino_t key, const std::string& path,
289-
WarmupStorageType type) {
290-
WriteLockGuard lock(inode2ProgressMutex_);
288+
virtual bool AddWarmupProcessLocked(fuse_ino_t key, const std::string& path,
289+
WarmupStorageType type) {
291290
auto retPg = inode2Progress_.emplace(key, WarmupProgress(type, path));
292291
return retPg.second;
293292
}

0 commit comments

Comments
 (0)