Skip to content

Commit

Permalink
[Fix] access deleted point in prefetch thread.
Browse files Browse the repository at this point in the history
Signed-off-by: Yifan Yuan <[email protected]>
  • Loading branch information
BigVan committed Aug 8, 2024
1 parent 7093da0 commit 0fe520b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/image_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ IFile *ImageFile::__open_ro_remote(const std::string &dir, const std::string &di
remote_file->ioctl(SET_LOCAL_DIR, dir);
} else {
LOG_WARN(
"local dir of layer %d (%s) didn't set, skip background anyway",
"local dir of layer ` (`) didn't set, skip background anyway",
layer_index, digest.c_str());
}

Expand Down Expand Up @@ -364,10 +364,6 @@ LSMT::IFileRO *ImageFile::open_lowers(std::vector<ImageConfigNS::LayerConfig> &l
}
LOG_INFO("LSMT::open_files_ro(files, `) success", lowers.size());

if (m_prefetcher != nullptr) {
m_prefetcher->replay((IFile*)ret);
}

return ret;

ERROR_EXIT:
Expand Down Expand Up @@ -508,6 +504,9 @@ int ImageFile::init_image_file() {
if (conf.download().enable() && !record_no_download) {
start_bk_dl_thread();
}
if (m_prefetcher != nullptr) {
m_prefetcher->replay(m_file);
}
return 1;

ERROR_EXIT:
Expand Down

0 comments on commit 0fe520b

Please sign in to comment.