From 0fe520b4f62685f8746203c0b171cf74d632e694 Mon Sep 17 00:00:00 2001 From: Yifan Yuan Date: Thu, 8 Aug 2024 12:35:34 +0800 Subject: [PATCH] [Fix] access deleted point in prefetch thread. Signed-off-by: Yifan Yuan --- src/image_file.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/image_file.cpp b/src/image_file.cpp index 1daeba6e..79b4f7e4 100644 --- a/src/image_file.cpp +++ b/src/image_file.cpp @@ -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()); } @@ -364,10 +364,6 @@ LSMT::IFileRO *ImageFile::open_lowers(std::vector &l } LOG_INFO("LSMT::open_files_ro(files, `) success", lowers.size()); - if (m_prefetcher != nullptr) { - m_prefetcher->replay((IFile*)ret); - } - return ret; ERROR_EXIT: @@ -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: