mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2026-04-25 21:35:58 +03:00
[GH-ISSUE #1811] Failed to truncate open and modified files to zero length #925
Labels
No labels
bug
bug
dataloss
duplicate
enhancement
feature request
help wanted
invalid
need info
performance
pull-request
question
question
testing
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/s3fs-fuse#925
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @VVoidV on GitHub (Dec 1, 2021).
Original GitHub issue: https://github.com/s3fs-fuse/s3fs-fuse/issues/1811
Version of s3fs being used (s3fs --version)
1.90
Version of fuse being used (pkg-config --modversion fuse, rpm -qi fuse, dpkg -s fuse)
2.9.2
Kernel information (uname -r)
5.4.140-1.el7.elrepo.x86_64
GNU/Linux Distribution, if applicable (cat /etc/os-release)
s3fs command line used, if applicable
s3fs syslog messages (grep s3fs /var/log/syslog, journalctl | grep s3fs, or s3fs outputs)
Details about issue
#1631 allow truncating open and modified file to larger size, but truncating to smaller size failed silently.
7703 2021-11-30T08:54:39.699Z [INF] s3fs.cpp:s3fs_truncate(2137): [path=/small8/vdb_control.file][size=0]
....
7715 2021-11-30T08:54:39.700Z [DBG] fdcache.cpp:Open(446): [path=/small8/vdb_control.file][size=0][time=-1]
7716 2021-11-30T08:54:39.700Z [DBG] fdcache_entity.cpp:Dup(246): [path=/small8/vdb_control.file][fd=9][refcnt=2]
7717 2021-11-30T08:54:39.700Z [DBG] fdcache_entity.cpp:Open(315): [path=/small8/vdb_control.file][fd=9][size=-1][time=-1]
the code related to this issue
github.com/s3fs-fuse/s3fs-fuse@85ca2a3e45/src/fdcache.cpp (L554-L560)How about adding a parameter to AutoFdEntity::Open() and FdManager::Open() to tell we are truncating the file to bypass this check?
Example test case
test code
output with s3fs
output with xfs