This simplifies code paths and makes memory leaks less likely. It
also makes memory ownership more explicit by requiring std::move.
This commit requires C++11. References #2179.
Previously pcfstat points to a raw pointer, and it may be leaked if
function returned before deleting it.
So use smart pointer to automatically release the object.
Note that currently s3fs only uses c++03, so we use auto_ptr here, not
unique_ptr, which requires c++11.
Fixes: 6ca5a24a7f ("Fix two inconsistency issues between stat cache and cache file (#2152)")
Signed-off-by: Eryu Guan <eguan@linux.alibaba.com>
FdEntity::Open() returns -errno on error, but FdManager::Open() only
checks if its ret is -1. This may lead to use '-errno' as pseudo fd
in next read or write, which would fail due to '-errno' is not in
fent map.
Signed-off-by: Eryu Guan <eguan@linux.alibaba.com>
fuse_main will do fork to daemonize. if ThreadPool is created before
this, worker thread will not be placed in child process.
Move ThreadPool Init to s3fs_init and destory to s3fs_destory.
Signed-off-by: liubingrun <liubr1@chinatelecom.cn>
* Add support for FUSE-T on macos
Signed-off-by: Alex Fishman <alex@fuse-t.org>
Signed-off-by: alex <alex@alex-NUC10.lan>
* Ignore value pointer when size is zero on setattrx
Signed-off-by: Alex Fishman <alex@fuse-t.org>
---------
Signed-off-by: Alex Fishman <alex@fuse-t.org>
Signed-off-by: alex <alex@alex-NUC10.lan>
* Fix inconsistency between stat cache file and cache file
We unlock stat cache file too early in FdEntity::Open(), and would
truncate cache file and update stat cache file, so there's a window that
stat cache doesn't reflect cache file status.
Suggested-by: Takeshi Nakatani <ggtakec@gmail.com>
Signed-off-by: Eryu Guan <eguan@linux.alibaba.com>
* Mark pagelist as unloaded if cache file has been truncated
If cache file size doesn't match object size, the cache file might be
corrupted, so invalidate it and save new cache stat file.
Suggested-by: Takeshi Nakatani <ggtakec@gmail.com>
Signed-off-by: Eryu Guan <eguan@linux.alibaba.com>
---------
Signed-off-by: Eryu Guan <eguan@linux.alibaba.com>