Skip to content

Commit

Permalink
Improved updating of temporary stat cache while creating a file
Browse files Browse the repository at this point in the history
  • Loading branch information
ggtakec committed Nov 7, 2023
1 parent a3964b3 commit 561ca21
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/s3fs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2563,6 +2563,21 @@ static int s3fs_utimens(const char* _path, const struct timespec ts[2])
// 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.(see s3fs_create)
// So we need to update the cache, if it exists.
//
// Previously, the process of creating a new file was to update the
// file content after first uploading the file, but now the file is
// not created until flushing.
// So we need to create a temporary Stat cache for it.
//
if(!StatCache::getStatCacheData()->AddStat(strpath, updatemeta, false, true)){
return -EIO;
}

}else{
S3FS_PRN_INFO("meta is not pending, but need to keep current mtime.");

Expand Down

0 comments on commit 561ca21

Please sign in to comment.