Fixed s3fs_flush to update pending meta for macos and nomultipart mode

This commit is contained in:
Takeshi Nakatani
2025-06-08 07:08:40 +00:00
committed by Andrew Gaul
parent 63402bb556
commit c620262d3d

View File

@ -2959,7 +2959,19 @@ static int s3fs_flush(const char* _path, struct fuse_file_info* fi)
S3FS_PRN_ERR("could not update ctime file(%s)", path);
return -EIO;
}
result = ent->Flush(static_cast<int>(fi->fh), false);
if(0 == (result = ent->Flush(static_cast<int>(fi->fh), false))){
// [NOTE]
// If there is any meta information that needs to be updated, update it now.
// If waiting until s3fs_release is called, problems may occur if reading the
// meta information of the target path during that period.
// (This case is found in macos + nomultipart mode)
//
if(0 != (result = ent->UploadPending(static_cast<int>(fi->fh)))){
S3FS_PRN_ERR("could not upload pending data(meta, etc) for pseudo_fd(%llu) / path(%s) by result=%d, but continue...", (unsigned long long)(fi->fh), path, result);
return result;
}
}
StatCache::getStatCacheData()->DelStat(path);
if(is_new_file){