Fixed a bug about could not copy file mode from org file

This commit is contained in:
Takeshi Nakatani 2016-09-11 13:09:23 +00:00
parent 6be3236b28
commit 1a96f40a10

View File

@ -1561,6 +1561,17 @@ static int s3fs_chmod(const char* path, mode_t mode)
return -EIO; return -EIO;
} }
StatCache::getStatCacheData()->DelStat(nowcache); StatCache::getStatCacheData()->DelStat(nowcache);
// check opened file handle.
//
// If we have already opened file handle, should set mode to it.
// And new mode is set when the file handle is closed.
//
FdEntity* ent;
if(NULL != (ent = FdManager::get()->ExistOpen(path))){
ent->SetMode(mode); // Set new mode to opened fd.
FdManager::get()->Close(ent);
}
} }
S3FS_MALLOCTRIM(0); S3FS_MALLOCTRIM(0);