mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2026-04-25 05:16:00 +03:00
[PR #2133] [MERGED] Fixed a bug when reading a reduced file without flushing #2349
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#2349
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?
📋 Pull Request Information
Original PR: https://github.com/s3fs-fuse/s3fs-fuse/pull/2133
Author: @ggtakec
Created: 3/18/2023
Status: ✅ Merged
Merged: 3/26/2023
Merged by: @ggtakec
Base:
master← Head:fix_filesize2📝 Commits (1)
148841eFixed a bug when reading a reduced file without flushing📊 Changes
7 files changed (+135 additions, -8 deletions)
View changed files
📝
.gitignore(+2 -0)📝
src/fdcache_page.cpp(+6 -0)📝
src/metaheader.cpp(+1 -1)📝
src/s3fs.cpp(+16 -3)📝
test/Makefile.am(+6 -4)📝
test/integration-test-main.sh(+23 -0)➕
test/truncate_read_file.c(+81 -0)📄 Description
Relevant Issue (if applicable)
#2107 #2131
This PR changed the fix method because #2131 was not enough fix.
Bug details
There was a bug in trauncate, which shrinks files.
This bug occurs under the following conditions:
At this time, it got the old size before shrinking from the server(Content-Length) and set old size again.
So that the read data from the reduced size to the original size padded as 0x00, and read it.
When read all of file, the read size is old length before reduction.
Fixes
Changed so that when opening a file that has already been opened and resized(without flushing), it is opened as the modified file size instead of the file size on the server side.
When reading(loading) a file, there was a problem that the modifying(shrink) flag was cleared after reading even though the file was reduced.
Therefore, there was a problem that flush(upload) of file size change did not occur, so it has been fixed.
Although it is not directly related to this case, there was a bug in the number of blocks used in the stat information, so it has been corrected.
I added C source code to test the condition that caused the failure and included it in this PR.
(Because it is difficult to realize with a shell script, I wrote it in C source)
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.