Merge pull request #1049 from gaul/external-modication

Remove cache file when object time differs
This commit is contained in:
Takeshi Nakatani
2019-06-24 00:51:54 +09:00
committed by GitHub
3 changed files with 25 additions and 1 deletions

View File

@ -842,6 +842,16 @@ int FdEntity::Open(headers_t* pmeta, off_t size, time_t time, bool no_fd_lock_wa
if(!cachepath.empty()){
// using cache
struct stat st;
if(stat(cachepath.c_str(), &st) == 0){
if(st.st_mtime < time){
S3FS_PRN_DBG("cache file stale, removing: %s", cachepath.c_str());
if(unlink(cachepath.c_str()) != 0){
return (0 == errno ? -EIO : -errno);
}
}
}
// open cache and cache stat file, load page info.
CacheFileStat cfstat(path.c_str());