Commit Graph

185 Commits

Author SHA1 Message Date
Takeshi Nakatani
2bb745cdd7 Fixed a bug about move file over limit of ensure space 2020-08-16 17:42:20 +09:00
Andrew Gaul
35090ba4d5 Call readdir instead of readdir_r
Only a single thread uses this directory stream.  Further, modern
implementations are thread-safe by default and deprecated this call:

https://man7.org/linux/man-pages/man3/readdir_r.3.html
2020-08-16 13:33:23 +09:00
Andrew Gaul
132a1bebbb Prefer %zd and %zu for ssize_t and size_t
This removes unnecessary casting.
2020-08-15 17:30:23 +09:00
Takeshi Nakatani
ad1961417d Added SIGUSR1 option for cache file integrity test 2020-07-26 21:04:11 +09:00
Takeshi Nakatani
700e288718 Put similar processing together into method GetCacheFileStatTopDir 2020-07-12 08:12:02 +00:00
Takeshi Nakatani
1f796d432d Fixed upload error about mixuploading sparse file and truncating file 2020-06-27 22:44:19 +09:00
Takeshi Nakatani
35006e318f Fixed about ParallelMixMultipartUpload 2020-06-24 12:48:55 +09:00
Takeshi Nakatani
f324d8e04f Fixed a bug about serializing from cache file 2020-06-19 12:57:27 +00:00
Takeshi Nakatani
0cb057dadd
Merge pull request #1303 from gaul/rename/use_cache
Relink cache stats file atomically via rename
2020-06-01 00:10:33 +09:00
Takeshi Nakatani
0f5db0d1bf
Merge pull request #1302 from gaul/rename/nocopy
Fix renames of open files with nocopyapi option
2020-05-31 23:46:46 +09:00
Andrew Gaul
274321524c Relink cache stats file atomically via rename
The new file may already exist so link may fail.  Further link/unlink
is not atomic.  Addresses an error when renaming an open with with
use_cache.  References #1296.
2020-05-31 23:09:58 +09:00
Andrew Gaul
40f7007263 Check results from pthread mutex calls
Also remove some unnecessary exception handling.
2020-05-30 16:37:55 +09:00
Andrew Gaul
66597ec5f2 Fix renames of open files with nocopyapi option
References #1296.
2020-05-30 15:45:43 +09:00
Takeshi Nakatani
97c249d5b9 Not abort process by exception threw from s3fs_strtoofft 2020-05-03 08:08:28 +00:00
Takeshi Nakatani
f26a0aa71d Fixed insufficient upload size for mix multipart upload 2020-04-22 09:31:22 +09:00
Takeshi Nakatani
4da02d023b Improved strictness of cache file stats(file) 2020-04-21 19:45:03 +09:00
Takeshi Nakatani
811ea0cb85 Fixed the truncation bug of stat file for cache file 2020-04-19 07:08:49 +00:00
Andrew Gaul
48a872e285 Address cppcheck 1.90 warning 2020-04-12 22:20:44 +09:00
Takeshi Nakatani
018ccb9a11 Suppressed a lot of message output about cache cleanup 2020-01-30 14:42:28 +00:00
yongqingliu
b762a0a85b fix deadlock due to fdmanager_lock and fdent_data_lock 2020-01-29 12:03:53 +08:00
Andrew Gaul
e0712f444d Update source for clang-tidy 9.0.0 2020-01-13 20:56:45 +09:00
Takeshi Nakatani
cf3e82d10a Fixed a rename bug when enable_noobj_cache 2019-10-23 12:39:42 +00:00
Takeshi Nakatani
1db94a0b30 Fixed to use copy api in multipart upload 2019-09-25 19:30:58 -07:00
Takeshi Nakatani
f5bf41cf11 Fixed simple copy with nocpoyapi and modify flag in fdcache 2019-08-11 07:42:48 +00:00
Takeshi Nakatani
3d70e8966f
Merge pull request #1108 from gaul/lock/diskspace
Always hold lock when accessing free_disk_space
2019-08-03 22:01:31 +09:00
Andrew Gaul
5b15c7c4e9 Always hold lock when accessing free_disk_space
Slightly reorder locks to avoid double locking.  Found via
ThreadSanitizer.
2019-07-30 08:36:54 -07:00
Andrew Gaul
afd438d363 Access FdEntity metadata while holding fdent_lock
Create copies to avoid thread races.  Found via ThreadSanitizer.
Follows on to ecf13a8cb9.
2019-07-29 13:54:57 -07:00
Andrew Gaul
bacd15714a Use consistent default for readwrite_timeout
Previously curl threads mutated this shared state without a lock.
Found via ThreadSanitizer.
2019-07-16 22:03:56 -07:00
Takeshi Nakatani
513f41fddf
Merge pull request #1097 from ggtakec/fix_lock
Add Lock() func parameter in RowFlush()
2019-07-15 11:56:21 +09:00
Takeshi Nakatani
543aed2a32
Merge pull request #1096 from gaul/pthread/lock-checking
Expand error checking to all pthread_mutex_t
2019-07-15 11:43:56 +09:00
Takeshi Nakatani
f78bcc5229 Add Lock() func parameter in RowFlush() 2019-07-15 01:52:29 +00:00
Andrew Gaul
43ec064fb9 Expand error checking to all pthread_mutex_t 2019-07-14 18:21:23 -07:00
Andrew Gaul
ffac4c8417 Avoid narrowing time_t and off_t args in logging
This displays correct results on 32-bit platforms.
2019-07-14 17:02:36 -07:00
Takeshi Nakatani
850a813171
Merge pull request #1092 from liuyongqing/master
fix coredump caused by fd_manager_lock locking
2019-07-15 04:53:10 +09:00
Takeshi Nakatani
d39e4e4b1f
Merge pull request #1087 from gaul/clang-tidy/deprecated-headers
Prefer modern C headers
2019-07-15 03:50:15 +09:00
Andrew Gaul
1eb266588e Add a missing lock to SetCtime
Also lock before log statements which touch member variables.
2019-07-13 17:53:38 -07:00
root
4e351c59e3 fix coredump caused by fd_manager_lock locking 2019-07-13 12:03:27 +08:00
Andrew Gaul
6fd42d9fe4 Prefer modern C headers
Found and fixed via clang-tidy.
2019-07-12 03:50:59 -07:00
Andrew Gaul
a83d5baa90 Remove recursive locking
Recursive locking is frowned upon and is incompatible with
PTHREAD_MUTEX_ERRORCHECK.  Also clean up pthread_mutex_lock error
checking.
2019-07-10 12:39:00 -07:00
Takeshi Nakatani
50d13255e4
Merge pull request #1081 from gaul/write-blocks-readdir
Break FdEntity locks into data and metadata
2019-07-11 03:40:26 +09:00
Takeshi Nakatani
d267212289
Merge pull request #1079 from gaul/cppcheck/shadowing
Avoid shadowing variable in FdEntity::Open
2019-07-07 16:29:42 +09:00
Andrew Gaul
ecf13a8cb9 Break FdEntity locks into data and metadata
Previously long-running data operations like RowFlush would block
metadata operations like GetStats and thus user readdir.  Fixes #928.
2019-07-05 23:12:24 -07:00
Andrew Gaul
49110c671d Avoid shadowing variable in FdEntity::Open
Found via cppcheck 1.88.
2019-07-05 15:06:18 -07:00
Andrew Gaul
febaf6849f Issue multipart when object size exceeds part size
Previously s3fs issued multipart uploads when the object size was
twice the part size.  Conjoining this with the part size was confusing
and s3fs should add a separate tunable for this if needed, similar to
singlepart_copy_limit.  Fixes #1058.
2019-07-05 12:14:56 -07:00
Andrew Gaul
455e29cbea Make fdpage a value type in fdpage_list_t
This simplifies memory management.
2019-07-01 09:30:48 -07:00
Andrew Gaul
d7f77a6282 Fix casting warning on 32-bit 2019-06-29 20:57:42 -07:00
Takeshi Nakatani
a78d8d1da4
Merge pull request #1049 from gaul/external-modication
Remove cache file when object time differs
2019-06-24 00:51:54 +09:00
Andrew Gaul
9e5eaad79b Remove cache file when object time differs
Check the modification times to determine whether an object has
updated.  This relies on low clock skew between s3fs and the S3
server; a more robust approach could use the ETag.  Fixes #1047.
2019-06-22 19:09:00 -07:00
Andrew Gaul
15b7450713 Convert file offsets from size_t to off_t
The latter is 64-bits on 32-bit platforms when specifying
-D_FILE_OFFSET_BITS=64.  This allows early Raspberry Pis to use files
larger than 2 GB.  It also cleans up some ugly casting.  Fixes #620.
Fixes #656.
2019-06-15 17:05:37 -07:00
Andrew Gaul
059ab1f0f4 Update ctime during nocopyapi operations
Follows on to 2c43b1e12b.  Fixes #971.
2019-04-30 18:59:51 +09:00
Andrew Gaul
6f6a67807b Prefer new over malloc
The former cannot return NULL and will allow use of scoped pointers.
2019-04-07 16:54:24 +09:00
Takeshi Nakatani
62dcda6a56 Fixed ref-count when error occurred. 2019-03-10 06:04:19 +00:00
Andrew Gaul
f53503438c Increase FdEntity reference count when returning
Previously s3fs had a race condition where one client could delete
FdEntity that another client was using.  Add a simple concurrent test
which previously failed but now succeeds.  Fixes #964.
2019-03-09 15:55:04 +09:00
Andrew Gaul
e87e40b3b4 Address miscellaneous clang-tidy warnings
Also add configuration with suppressions.
2019-02-04 22:58:40 -08:00
Takeshi Nakatani
fb6debd986
Merge pull request #948 from gaul/too-many-parts
Add logging for too many parts
2019-02-03 14:55:54 +09:00
Takeshi Nakatani
c603680e02
Merge pull request #939 from gaul/stringstream-specific
Prefer specific [io]stringstream where possible
2019-02-03 11:06:57 +09:00
Andrew Gaul
dfa84b82a8 Add logging for too many parts
References #610.
2019-02-01 19:34:26 -08:00
Andrew Gaul
07636c8a8d Prefer specific [io]stringstream where possible
These better communicate intent and are slightly more efficient.
2019-01-29 10:44:33 -08:00
Andrew Gaul
35d55ee513 Remove unneeded void parameter
This is implicit in C++.  Found and fixed via clang-tidy.
2019-01-28 23:22:27 -08:00
Takeshi Nakatani
c0cf90cf8b Checked and corrected all typo 2019-01-27 12:04:29 +00:00
Takeshi Nakatani
3b1cc3b197
Merge pull request #933 from gaul/cache/remove-mirror-path
Remove mirror path when deleting cache
2019-01-27 16:15:49 +09:00
Andrew Gaul
a93e500b44 Remove mirror path when deleting cache
Fixes #827.
2019-01-25 18:10:03 -08:00
Andrew Gaul
84b421d6ef Prefer empty over size checks
Found and fixed via clang-tidy.
2019-01-23 11:30:28 -08:00
Takeshi Nakatani
010276ceab
Merge pull request #921 from gaul/clang-tidy/redundant-string-init
Remove redundant string initializations
2019-01-23 19:44:59 +09:00
Andrew Gaul
1fc25e8c3f Remove redundant string initializations
Found and fixed via clang-tidy.
2019-01-22 23:16:37 -08:00
Andrew Gaul
5f5da4b2cb Load tail range during overwrite
Previously s3fs experienced data loss when writing to the middle of a
file.  Corrupt files would have the expected data from 0..offset+size
but unexpected NUL bytes from offset+size..EOF.  References #808.
2019-01-22 22:02:40 -08:00
Andrew Gaul
40ba3b44a1 Prefer abort over assert(false)
The compiler can remove the latter when compiled with NDEBUG which may
cause unintended control flow.
2019-01-20 12:30:27 -08:00
Andrew Gaul
2c43b1e12b Store and retrieve file change time
This introduces a new header with the change time; existing objects
will report modification time.  Fixes #771.
2019-01-14 10:05:11 -08:00
Andrew Gaul
a2f8ac535e Address cppcheck 1.86 errors
Lifetime, shadowing, and unused variables.  Found via the Travis macOS
builder.
2018-12-20 14:56:31 -08:00
Takeshi Nakatani
f71a28f9b9
Merge pull request #714 from orozery/reduce_lock_contention
reduce lock contention on file open
2018-03-04 13:36:08 +09:00
Or Ozeri
8b657eee41 add disk space reservation 2018-02-28 19:20:23 +02:00
Takeshi Nakatani
c494e54320 Fixed cppcheck error on osx 2018-02-28 12:06:06 +00:00
Or Ozeri
0edf056e95 reduce lock contention on file open 2018-02-04 17:13:58 +02:00
Takeshi Nakatani
6b58220009
Merge pull request #697 from pwulff/master
Fixing race condition in FdEntity::GetStats
2017-12-17 15:46:48 +09:00
Paul Wulff
ee6abea956 Race condition in FdManager::Rename because no mutex is used. 2017-12-15 15:27:51 +01:00
Paul Wulff
cea7d44717 Fixing race condition in FdEntity::GetStats 2017-12-13 10:49:00 +01:00
Or Ozeri
0da87e75fe fix condition for parallel download 2017-12-04 16:07:33 +02:00
Takeshi Nakatani
026260e7a1 Improved use of temporary files 2017-11-23 09:18:11 +00:00
Andrew Gaul
0418e53b3c Reduce use of preprocessor
This provides type-safety and avoids token expansion side effects.
2017-11-18 22:40:06 -08:00
Andrew Gaul
40501a7a73 Lock FdEntity when mutating orgmeta
References #654.
2017-10-23 22:41:42 -07:00
Scott Talbert
20da0e4dd3 Fix intermittent upload failures on macOS
There were multiple problems with the FdManager::GetFreeDiskSpace() function
on macOS:
1) When calling statvfs(), f_frsize should be used instead of f_bsize when
converting available blocks to bytes.  This was causing the free space
calculation to be incorrect.
2) On macOS, fsblkcnt_t is a 32-bit integer.  Thus, when calculating available
disk space, there were frequently overflows.  This caused s3fs to incorrectly
determine that the cache location was out of space in the middle of a transfer
which caused uploads to fail.  Changing this to a uint64_t resolves the
problem.
2017-09-08 15:23:10 -04:00
Takeshi Nakatani
9d10a5aa70 Changed copyright year format for debian pkg 2017-05-07 11:24:17 +00:00
Takeshi Nakatani
28efff5986 Merge pull request #554 from orozery/cache_cleanup
cleanup cache directory when running out of disk space
2017-04-16 19:13:11 +09:00
Takeshi Nakatani
fef3fbc225 Added check_cache_dir_exist option(refixed #347) - #538 2017-04-02 08:10:16 +00:00
Or Ozeri
95578cad43 cleanup cache directory when running out of disk space 2017-04-02 10:22:12 +03:00
Takeshi Nakatani
7b307601b5 Merge pull request #511 from s3fs-fuse/issue#435
Fixed a bug about uploading NULL to some part of the file contents
2016-12-04 17:20:50 +09:00
Andrew Gaul
d375bca0d0 Correct typos 2016-11-19 15:57:41 -08:00
Takeshi Nakatani
81e209bdd1 Fixed issue#435 codes 2016-11-19 20:09:35 +00:00
Takeshi Nakatani
a688df813e Fixed a bug at read symlink 2016-10-11 13:32:08 +00:00
Takeshi Nakatani
716baada22 Testing patch codes for issue#435 2016-10-10 12:16:09 +00:00
Takeshi Nakatani
e8a8019a71 Add mirror file logic for removing cache file 2016-07-03 03:37:08 +00:00
Andrew Gaul
95cb5d201f Correct search and replace typo 2016-06-13 10:25:33 -07:00
Takeshi Nakatani
090c37a1c1 Fixed writing sparsed file - #375,#379,#394 2016-04-12 18:24:36 +00:00
Takeshi Nakatani
fff40bbff3 Revert "Fixed a bug about writing sparsed file - #375" 2016-04-13 01:24:24 +09:00
Takeshi Nakatani
ded4faf2e4 Fixed a bug about writing sparsed file - #375 2016-03-22 05:44:14 +00:00
Takeshi Nakatani
150b83f61e Remove stat file cache dir if specified del_cache - #337 2016-02-06 18:59:13 +00:00
Takeshi Nakatani
c5a94cfc0c Check cache dirctory path and attributes - #347 2016-02-06 13:38:48 +00:00
haoran.yanghr
e3765ad497 Tune the code indent. 2016-01-28 11:16:06 +08:00
haoran.yanghr
dd9f3aed36 Fix the memory leak issue in fdcache. See issue #340 2016-01-28 11:11:53 +08:00
Takeshi Nakatani
759b44135a Check pthread prtability in configure as additional change for #307 2015-12-03 07:47:17 +00:00