From 55f1b0fed1764687ad7ca67b8d1da36441e3a109 Mon Sep 17 00:00:00 2001 From: "hzwuhongsong@corp.netease.com" Date: Fri, 29 Apr 2022 10:45:28 +0800 Subject: [PATCH] curvefs/client: fix bug of io hang --- curvefs/src/client/s3/client_s3_cache_manager.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/curvefs/src/client/s3/client_s3_cache_manager.cpp b/curvefs/src/client/s3/client_s3_cache_manager.cpp index b5c4bb3fc3..91a2181c14 100644 --- a/curvefs/src/client/s3/client_s3_cache_manager.cpp +++ b/curvefs/src/client/s3/client_s3_cache_manager.cpp @@ -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";