Skip to content

Commit

Permalink
Re-improved updating of temporary stat cache when new file
Browse files Browse the repository at this point in the history
  • Loading branch information
ggtakec authored and gaul committed Nov 10, 2023
1 parent b15ed13 commit e2ac9b4
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/s3fs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2031,6 +2031,16 @@ static int s3fs_chmod(const char* _path, mode_t mode)

// If there is data in the Stats cache, update the Stats cache.
StatCache::getStatCacheData()->UpdateMetaStats(strpath, updatemeta);

// [NOTE]
// There are cases where this function is called during the process of
// creating a new file (before uploading).
// In this case, a temporary cache exists in the Stat cache.
// So we need to update the cache, if it exists. (see. s3fs_create and s3fs_utimens)
//
if(!StatCache::getStatCacheData()->AddStat(strpath, updatemeta, false, true)){
return -EIO;
}
}
}
if(need_put_header){
Expand Down Expand Up @@ -2236,6 +2246,16 @@ static int s3fs_chown(const char* _path, uid_t uid, gid_t gid)

// If there is data in the Stats cache, update the Stats cache.
StatCache::getStatCacheData()->UpdateMetaStats(strpath, updatemeta);

// [NOTE]
// There are cases where this function is called during the process of
// creating a new file (before uploading).
// In this case, a temporary cache exists in the Stat cache.
// So we need to update the cache, if it exists. (see. s3fs_create and s3fs_utimens)
//
if(!StatCache::getStatCacheData()->AddStat(strpath, updatemeta, false, true)){
return -EIO;
}
}
}
if(need_put_header){
Expand Down Expand Up @@ -3948,6 +3968,16 @@ static int s3fs_setxattr(const char* path, const char* name, const char* value,

// If there is data in the Stats cache, update the Stats cache.
StatCache::getStatCacheData()->UpdateMetaStats(strpath, updatemeta);

// [NOTE]
// There are cases where this function is called during the process of
// creating a new file (before uploading).
// In this case, a temporary cache exists in the Stat cache.
// So we need to update the cache, if it exists. (see. s3fs_create and s3fs_utimens)
//
if(!StatCache::getStatCacheData()->AddStat(strpath, updatemeta, false, true)){
return -EIO;
}
}
}
if(need_put_header){
Expand Down

0 comments on commit e2ac9b4

Please sign in to comment.