mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2026-04-25 13:26:00 +03:00
[PR #1274] [MERGED] Improved strictness of cache file stats(file) #1894
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#1894
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/1274
Author: @ggtakec
Created: 4/19/2020
Status: ✅ Merged
Merged: 4/21/2020
Merged by: @gaul
Base:
master← Head:fix_cache_stat📝 Commits (1)
8ae9aacImproved strictness of cache file stats(file)📊 Changes
2 files changed (+135 additions, -18 deletions)
View changed files
📝
src/fdcache.cpp(+131 -17)📝
src/fdcache.h(+4 -1)📄 Description
Relevant Issue (if applicable)
#1271
Details
This PR code was modified to strictly manage the file(cache file stats) that holds the state of the s3fs cache file.
If the user has caching turned on, s3fs will load the cache file status(information on the range where the file contents are cached) from this file when opening it.
And if user edits the file, the cache will change and the cache file stats will change as well.
This cache file stats is written out when the file is closed(and flushed).
That is, the cache file stats(file) is loaded when user opens the file and writes when user closes it.
Access to the cache file stats(file) is exclusively controlled within the s3fs process.
Therefore, input/output to this file is performed simultaneously with the cache file with exclusive control.
However, s3fs must ensure that the cache file and its status file (cache file stats) are paired.
In this PR, it is modified to write the cache file's inode number to the cache file stats(file).
And the inode number is checked when loading this file.
When loading the cache file stats(file) output by s3fs before PR, the inode is not checked and the access to cache file is allowed.
However, when the cache status changes and the file(object) is closed, the cache file stats(file) is written out in the new format.
This maintains backward compatibility.
Be careful, an error will occur if the cache file stats(file) created by this PR code is loaded by old s3fs version.
In this case, that cache won't load, and s3fs will get the file(object) from S3 server.
Please note that multiple s3fs processes can not use the same cache directory at the same time.
The s3fs cache does not support multiple s3fs processes.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.