mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2025-02-02 18:48:26 +00:00
Fixed a bug about overwrite metadata at updating directory stats
This commit is contained in:
parent
9f6ed6c08e
commit
ea517c80a4
29
src/s3fs.cpp
29
src/s3fs.cpp
@ -382,7 +382,7 @@ static int chk_dir_object_type(const char* path, string& newpath, string& nowpat
|
|||||||
(*pType) = DIRTYPE_NOOBJ;
|
(*pType) = DIRTYPE_NOOBJ;
|
||||||
nowpath = "";
|
nowpath = "";
|
||||||
}else{
|
}else{
|
||||||
nowpath = path;
|
nowpath = newpath;
|
||||||
if(0 < nowpath.length() && '/' == nowpath[nowpath.length() - 1]){
|
if(0 < nowpath.length() && '/' == nowpath[nowpath.length() - 1]){
|
||||||
// "dir/" type
|
// "dir/" type
|
||||||
(*pType) = DIRTYPE_NEW;
|
(*pType) = DIRTYPE_NEW;
|
||||||
@ -842,18 +842,23 @@ static int put_headers(const char* path, headers_t& meta, bool is_copy)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FdEntity* ent = NULL;
|
// [NOTE]
|
||||||
if(NULL == (ent = FdManager::get()->ExistOpen(path, -1, !FdManager::IsCacheDir()))){
|
// if path is 'dir/', it does not have cache(could not open file for directory stat)
|
||||||
// no opened fd
|
//
|
||||||
if(FdManager::IsCacheDir()){
|
if('/' != path[strlen(path) - 1]){
|
||||||
// create cache file if be needed
|
FdEntity* ent = NULL;
|
||||||
ent = FdManager::get()->Open(path, &meta, static_cast<ssize_t>(buf.st_size), -1, false, true);
|
if(NULL == (ent = FdManager::get()->ExistOpen(path, -1, !FdManager::IsCacheDir()))){
|
||||||
|
// no opened fd
|
||||||
|
if(FdManager::IsCacheDir()){
|
||||||
|
// create cache file if be needed
|
||||||
|
ent = FdManager::get()->Open(path, &meta, static_cast<ssize_t>(buf.st_size), -1, false, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(ent){
|
||||||
|
time_t mtime = get_mtime(meta);
|
||||||
|
ent->SetMtime(mtime);
|
||||||
|
FdManager::get()->Close(ent);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if(ent){
|
|
||||||
time_t mtime = get_mtime(meta);
|
|
||||||
ent->SetMtime(mtime);
|
|
||||||
FdManager::get()->Close(ent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user