mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2026-04-25 13:26:00 +03:00
[GH-ISSUE #290] File opened with O_TRUNC is not flushed #150
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#150
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 @RobbKistler on GitHub (Nov 4, 2015).
Original GitHub issue: https://github.com/s3fs-fuse/s3fs-fuse/issues/290
s3fs-fuse @
ad2a406205Scenerio:
Open an existing file, non-empty file O_TRUNC and close it (no writes),
Expected results:
File with zero length. (Verified on local ext4 filesystem)
Actual results:
The file still contains original content.
@RobbKistler commented on GitHub (Nov 4, 2015):
Created PR with repro test and potential fix.
@ggtakec commented on GitHub (Nov 8, 2015):
@RobbKistler Thanks for your fixed codes.
I made a few changes to your correction.
Only when the file size is needed to change, s3fs calls RowFlush function.
When the open function is called with O_TRUNC, the file size is set Zero as soon as possible.
So it means that s3fs calls REST api(upload zero size object) when calling open with O_TRUNC.
Then you are correct about calls flush, but it does not need evey time.
My changes after your cahnages, If the file size is zero, s3fs does not call flush.
Please check it.
Thanks in advance for your help.
@RobbKistler commented on GitHub (Nov 9, 2015):
Look great! Thank you.