mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2025-01-08 15:44:11 +00:00
Fixed a bug
1 ) Fixed a bug Since r458, s3fs uses stat files of cache files. But s3fs forgot removing these stat files when s3fs removed cache files. Fixed this bug. git-svn-id: http://s3fs.googlecode.com/svn/trunk@459 df820570-a93a-0410-bd06-b72b767a4274
This commit is contained in:
parent
3274f58948
commit
bf11a0444f
@ -75,6 +75,26 @@ bool CacheFileStat::MakeCacheFileStatPath(const char* path, string& sfile_path,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CacheFileStat::DeleteCacheFileStat(const char* path)
|
||||
{
|
||||
if(!path || '\0' == path[0]){
|
||||
return false;
|
||||
}
|
||||
// stat path
|
||||
string sfile_path;
|
||||
if(!CacheFileStat::MakeCacheFileStatPath(path, sfile_path, false)){
|
||||
//FGPRINT("CacheFileStat::DeleteCacheFileStat: failed to create cache stat file path(%s)\n", path.c_str());
|
||||
//SYSLOGERR("failed to create cache stat file path(%s)", path.c_str());
|
||||
return false;
|
||||
}
|
||||
if(0 != unlink(sfile_path.c_str())){
|
||||
//FGPRINT("CacheFileStat::DeleteCacheFileStat: failed to delete file(%s): errno=%d\n", path, errno);
|
||||
//SYSLOGERR("failed to delete file(%s): errno=%d", path, errno);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
// CacheFileStat methods
|
||||
//------------------------------------------------
|
||||
@ -1063,12 +1083,22 @@ int FdManager::DeleteCacheFile(const char* path)
|
||||
if(!FdManager::MakeCachePath(path, cache_path, false)){
|
||||
return 0;
|
||||
}
|
||||
int result = 0;
|
||||
if(0 != unlink(cache_path.c_str())){
|
||||
//FGPRINT("FdManager::DeleteCacheFile: failed to delete file(%s): errno=%d\n", path, errno);
|
||||
//SYSLOGERR("failed to delete file(%s): errno=%d", path, errno);
|
||||
return -errno;
|
||||
result = -errno;
|
||||
}
|
||||
return 0;
|
||||
if(!CacheFileStat::DeleteCacheFileStat(path)){
|
||||
//FGPRINT("FdManager::DeleteCacheFile: failed to delete stat file(%s): errno=%d\n", path, errno);
|
||||
//SYSLOGERR("failed to delete stat file(%s): errno=%d", path, errno);
|
||||
if(0 != errno){
|
||||
result = -errno;
|
||||
}else{
|
||||
result = -EIO;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
bool FdManager::MakeCachePath(const char* path, string& cache_path, bool is_create_dir)
|
||||
|
@ -14,6 +14,8 @@ class CacheFileStat
|
||||
static bool MakeCacheFileStatPath(const char* path, std::string& sfile_path, bool is_create_dir = true);
|
||||
|
||||
public:
|
||||
static bool DeleteCacheFileStat(const char* path);
|
||||
|
||||
CacheFileStat(const char* tpath = NULL);
|
||||
~CacheFileStat();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user