Skip to content

Commit

Permalink
[fix]curvefs/client: fix client core dump
Browse files Browse the repository at this point in the history
use object instaed of pointer

Signed-off-by: Cyber-SiKu <[email protected]>
  • Loading branch information
Cyber-SiKu authored and wuhongsong committed Jan 13, 2023
1 parent 9de6b45 commit 796195d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
18 changes: 8 additions & 10 deletions curvefs/src/client/fuse_s3_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,12 @@ void FuseS3Client::fetchDataEnqueue(fuse_ino_t ino) {
<< ", inodeid = " << ino;
return;
}
google::protobuf::Map<uint64_t, S3ChunkInfoList> *s3ChunkInfoMap
= nullptr;
google::protobuf::Map<uint64_t, S3ChunkInfoList> s3ChunkInfoMap;
{
::curve::common::UniqueLock lgGuard = inodeWrapper->GetUniqueLock();
s3ChunkInfoMap = inodeWrapper->GetChunkInfoMap();
s3ChunkInfoMap = *inodeWrapper->GetChunkInfoMap();
}
if (nullptr == s3ChunkInfoMap ||
s3ChunkInfoMap->empty()) {
if (s3ChunkInfoMap.empty()) {
return;
}
travelChunks(ino, s3ChunkInfoMap);
Expand Down Expand Up @@ -370,18 +368,18 @@ void FuseS3Client::WarmUpAllObjs(
}
}

void FuseS3Client::travelChunks(fuse_ino_t ino, google::protobuf::Map<uint64_t,
S3ChunkInfoList> *s3ChunkInfoMap) {
void FuseS3Client::travelChunks(
fuse_ino_t ino,
const google::protobuf::Map<uint64_t, S3ChunkInfoList>& s3ChunkInfoMap) {
VLOG(9) << "travel chunk start: " << ino
<< ", size: " << s3ChunkInfoMap->size();
<< ", size: " << s3ChunkInfoMap.size();
std::list<std::pair<std::string, uint64_t>> prefetchObjs;
for (auto &iter : *s3ChunkInfoMap) {
for (auto const& iter : s3ChunkInfoMap) {
VLOG(9) << "travel chunk: " << iter.first;
travelChunk(ino, iter.second, &prefetchObjs);
}
WarmUpAllObjs(prefetchObjs);
VLOG(9) << "travel chunks end";
return;
}

void FuseS3Client::UnInit() {
Expand Down
5 changes: 3 additions & 2 deletions curvefs/src/client/fuse_s3_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ class FuseS3Client : public FuseClient {
// then can downlaod the objs belong to it
void fetchDataEnqueue(fuse_ino_t ino);
// travel all chunks
void travelChunks(fuse_ino_t ino, google::protobuf::Map<uint64_t,
S3ChunkInfoList> *s3ChunkInfoMap);
void travelChunks(
fuse_ino_t ino,
const google::protobuf::Map<uint64_t, S3ChunkInfoList>& s3ChunkInfoMap);
// travel and download all objs belong to the chunk
void travelChunk(fuse_ino_t ino, S3ChunkInfoList chunkInfo,
std::list<std::pair<std::string, uint64_t>>* prefetchObjs);
Expand Down

0 comments on commit 796195d

Please sign in to comment.