[PR #1274] [MERGED] Improved strictness of cache file stats(file) #1894

Closed
opened 2026-03-04 02:02:40 +03:00 by kerem · 0 comments
Owner

📋 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: masterHead: fix_cache_stat


📝 Commits (1)

  • 8ae9aac Improved 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.

## 📋 Pull Request Information **Original PR:** https://github.com/s3fs-fuse/s3fs-fuse/pull/1274 **Author:** [@ggtakec](https://github.com/ggtakec) **Created:** 4/19/2020 **Status:** ✅ Merged **Merged:** 4/21/2020 **Merged by:** [@gaul](https://github.com/gaul) **Base:** `master` ← **Head:** `fix_cache_stat` --- ### 📝 Commits (1) - [`8ae9aac`](https://github.com/s3fs-fuse/s3fs-fuse/commit/8ae9aac24817f293af285c07affd30f8efb68496) Improved strictness of cache file stats(file) ### 📊 Changes **2 files changed** (+135 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `src/fdcache.cpp` (+131 -17) 📝 `src/fdcache.h` (+4 -1) </details> ### 📄 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-04 02:02:40 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/s3fs-fuse#1894
No description provided.