Skip to content

Commit

Permalink
Fixed a bug when changing fdentity to a temporary path
Browse files Browse the repository at this point in the history
  • Loading branch information
ggtakec committed Oct 30, 2024
1 parent 330cb39 commit 918d6ac
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/fdcache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,8 +751,25 @@ bool FdManager::Close(FdEntity* ent, int fd)

bool FdManager::ChangeEntityToTempPath(std::shared_ptr<FdEntity> ent, const char* path)
{
// [NOTE]
// If the path element does not exist in fent, it may be because a cache directory
// has not been specified, or FdEntity::NoCacheLoadAndPost has already been called.
// In these cases, the path element(=ent) has already been registered as a TempPath
// element from fent, so there is no need to register ent in the except_fent map.
// (Processing with UpdateEntityToTempPath should not be performed.)
//
{
const std::lock_guard<std::mutex> lock(FdManager::fd_manager_lock);

if(fent.cend() == fent.find(path)){
S3FS_PRN_INFO("Already path(%s) element does not exist in fent map.", path);
return false;
}
}

const std::lock_guard<std::mutex> lock(FdManager::except_entmap_lock);
except_fent[path] = std::move(ent);

return true;
}

Expand Down

0 comments on commit 918d6ac

Please sign in to comment.