Skip to content

Commit

Permalink
curvefs/client: fix bug of io hang
Browse files Browse the repository at this point in the history
  • Loading branch information
wuhongsong committed Apr 29, 2022
1 parent ae566eb commit d4bfa7e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions curvefs/src/client/s3/client_s3_cache_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -999,13 +999,12 @@ CURVEFS_ERROR FileCacheManager::Flush(bool force, bool toS3) {
flushTasks.emplace_back(context);
}
pendingReq.fetch_add(flushTasks.size(), std::memory_order_seq_cst);
for (auto iter = flushTasks.begin();
iter != flushTasks.end(); ++iter) {
s3ClientAdaptor_->Enqueue(*iter);
}

if (pendingReq.load(std::memory_order_seq_cst)) {
VLOG(6) << "wait for pendingReq";
for (auto iter = flushTasks.begin();
iter != flushTasks.end(); ++iter) {
s3ClientAdaptor_->Enqueue(*iter);
}
cond.Wait();
}
VLOG(6) << "file cache flush over";
Expand Down

0 comments on commit d4bfa7e

Please sign in to comment.