Commit Graph

1143 Commits

Author SHA1 Message Date
Andrew Gaul
6823c5a7ec
Enable clang-tidy cppcoreguidelines (#2269) 2023-08-15 22:12:33 +09:00
Andrew Gaul
d1272d296a
Tighten up CLI argument handling (#2268)
This ensures that each option is only handled once.
2023-08-15 21:45:38 +09:00
Andrew Gaul
d120e54284
Improve illegal bucket name error message (#2263)
This may help users debug situations like:

https://stackoverflow.com/questions/76359564/why-does-mounting-s3fs-bucket-on-centos-7-using-fstab-fail-but-mount-a-works
2023-08-15 21:31:05 +09:00
Andrew Gaul
e157d811cb
Use std::string::compare and operator== where possible (#2256) 2023-08-15 21:22:36 +09:00
Andrew Gaul
56a4e67009
Replace more raw pointers with std::unique_ptr (#2255) 2023-08-14 00:03:10 +09:00
Takeshi Nakatani
5b93765802 Fixed a warning for compiling C/C++ codes 2023-08-13 20:49:39 +09:00
Takeshi Nakatani
acea1d33f9 Fixed string test for s3fs_base64 2023-08-13 20:48:38 +09:00
Andrew Gaul
528a61718d
Convert manual memory allocations to std::unique_ptr (#2253) 2023-08-11 23:26:07 +09:00
Andrew Gaul
c5a75a1fb2
Delete copy constructors and assignment operators (#2257)
One of these was buggy and others had the wrong parameters and return
types.
2023-08-11 13:12:03 +09:00
Andrew Gaul
3790a0f8b4
Calculate MD5 without using a temporary file (#2252)
This mirrors the SHA256 code.
2023-08-07 00:17:15 +09:00
Andrew Gaul
779afe5d62
Make help more consistent (#2251) 2023-08-06 22:25:10 +09:00
Andrew Gaul
26b5658d70
Wrap ps3fscred with std::unique_ptr (#2250)
This removes many manual memory deallocations.
2023-08-06 22:23:25 +09:00
Andrew Gaul
c568a69452
Return std::string from base64 encoding function (#2248)
This is avoids manual memory allocations.
2023-08-06 22:22:02 +09:00
Andrew Gaul
13ad53eef7
Convert most std::list to std::vector (#2247)
This tends to be more efficient due to fewer allocations.  Also fix std::sort
comparator which should be strictly less than.
2023-08-05 10:05:32 +09:00
Andrew Gaul
b5c3fc0a08
Convert fixed-size allocations to C++11 std::array (#2242)
This is safer and more efficient.
2023-08-05 09:36:22 +09:00
Andrew Gaul
b29f8d0f2b
Use C++ enum class for most enums (#2241)
This promotes type-safety.
2023-07-30 22:53:17 +09:00
Andrew Gaul
5699875e30
Use C++11 emplace where possible (#2240)
This is more concise and sometimes more efficient.
2023-07-30 22:51:20 +09:00
Andrew Gaul
a7b38a6940
Address stray warnings (#2237) 2023-07-29 09:19:18 +09:00
Andrew Gaul
1f04165a33
Convert most str callers to C++11 std::to_string (#2238)
Remaining ones handle timespec.
2023-07-28 18:21:55 +09:00
Andrew Gaul
36db898d01
Use C++11 std::map::erase return value (#2236) 2023-07-27 23:34:43 +09:00
Andrew Gaul
a4a2841c05
Use C++11 nullptr instead of 0 or NULL (#2234)
This improves type-safety.
2023-07-27 21:56:58 +09:00
Andrew Gaul
0ece204393 Fix -Wshorten-64-to-32 warnings 2023-07-27 12:23:26 +09:00
Andrew Gaul
6344d74ae3
Replace some raw pointers with std::unique_ptr (#2195)
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.
2023-07-27 09:12:28 +09:00
Takeshi Nakatani
faec0d9d15 Refixed for cppcheck 2.1x 2023-07-26 07:55:33 +09:00
Takeshi Nakatani
cb3dc28e6e Supported cppcheck 2.10(and changed std from c++03 to c++11 for RHEL7) 2023-07-25 08:08:06 +09:00
Andrew Gaul
2405706643
Insert SSE headers when appropriate (#2228)
References #2218.  References #2227.
2023-07-23 16:17:34 +09:00
Eryu Guan
7978395083 Use smart pointer to manage pcfstat object
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>
2023-07-19 20:15:55 +09:00
Takeshi Nakatani
d0a944fcaa Fixed data race about fuse_fill_dir_t function and data pointer 2023-07-14 22:32:12 +09:00
Andrew Gaul
537384e9b5
Guard filler calls with filled check (#2215)
Follows on to e650d8c55c.
2023-07-13 22:46:19 +09:00
Andrew Gaul
e650d8c55c
Explicitly handle CommonPrefixes with nocompat_dir (#2212)
Previously the test missed listing implicit directories and another
test was incorrect.  This fixes a regression from 1.91.
2023-07-13 21:15:34 +09:00
Takeshi Nakatani
9663215bb4 Fixed data race at OPENSSL_sk_dup/free in libcurl 2023-07-12 22:51:57 +09:00
Takeshi Nakatani
b2537052ef Fixed data race in threads found thread sanitizer 2023-07-09 20:53:27 +09:00
Eryu Guan
2e51908bec Check FdEntity::Open() status correctly
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>
2023-07-05 08:50:12 +09:00
LiuBingrun
a8edbd8622
fix streamuplod not working (#2204)
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>
2023-07-02 10:56:59 +09:00
Alex Fishman
03066ea29a
Fix extended attribute support when using FUSE-T (#2201)
* 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>
2023-06-26 22:05:37 +09:00
Andrew Gaul
6448c8f1a8
Protect FdEntity::physical_fd with fdent_lock (#2194)
* Protect FdEntity::physical_fd with fdent_lock
Found via ThreadSanitizer.
2023-06-25 16:43:15 +09:00
Andrew Gaul
3b6688253f
Address cppcheck 2.10 warnings (#2163)
Disable newer cppcheck until we can diagnose this further.
References #2162.
2023-06-25 16:04:16 +09:00
Takeshi Nakatani
580775b47c Removed unnecessary debug output 2023-06-07 20:48:50 -07:00
Eryu Guan
6ca5a24a7f
Fix two inconsistency issues between stat cache and cache file (#2152)
* 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>
2023-05-30 18:39:50 +09:00
Takeshi Nakatani
0d6b02090e
Revert "Update curl.cpp: reduce memory cache use (#2157)" (#2170)
This reverts commit 5b487f651a.
2023-05-27 20:33:43 +09:00
Tan Guofu
5b487f651a
Update curl.cpp: reduce memory cache use (#2157)
flush the file and clean the page cache when filepart download done
2023-05-27 19:15:47 +09:00
Takeshi Nakatani
1fc0e52dc3 Fixed mount point stat flag to be thread safe 2023-05-21 13:46:06 +09:00
Andrew Gaul
59c3b26655
Fix clang-tidy 16 nits (#2158) 2023-05-14 01:59:26 +09:00
Takeshi Nakatani
8296fe32cb
Directly and simplify requests in mount point checks (#2155) 2023-05-14 01:29:24 +09:00
Takeshi Nakatani
ca9a257eec
Allow mount points without directory objects by compat_dir (#2153) 2023-05-07 09:15:27 +09:00
Takeshi Nakatani
6d4bb59865
Corresponded to upload in case of calling release without flush (#2150) 2023-04-23 22:59:04 +09:00
Ottavia Balducci
9b75abfbe6
New option: bucket_size (#2148)
* Added bucket_size option
2023-04-23 14:04:38 +09:00
Takeshi Nakatani
c4f95f14cb
Fixed a bug about attributes of mount point (#2147) 2023-04-15 14:34:39 +09:00
Takeshi Nakatani
9c74014443
Fixed a bug in handling file names containing CR(0x1D) (#2136) 2023-03-26 13:19:16 +09:00
Takeshi Nakatani
a25cb9e07a
Fixed a bug when reading a reduced file without flushing (#2133) 2023-03-26 11:45:21 +09:00