[PR #1964] [MERGED] Added stat information to the mount point #2274

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

📋 Pull Request Information

Original PR: https://github.com/s3fs-fuse/s3fs-fuse/pull/1964
Author: @ggtakec
Created: 6/20/2022
Status: Merged
Merged: 10/22/2022
Merged by: @ggtakec

Base: masterHead: fix_root_stat


📝 Commits (1)

  • c76b8c5 Added stat information to the mount point

📊 Changes

2 files changed (+263 additions, -90 deletions)

View changed files

📝 src/s3fs.cpp (+178 -90)
📝 test/integration-test-main.sh (+85 -0)

📄 Description

Relevant Issue (if applicable)

#1961 #1962

Details

NOTE: This fix is a preliminary fix needed to resolve #1961 and #1962.

This PR allows user to retain the mount point's stat information.

Background

The mount point that s3fs mounts does not have stat information.
Therefore, the situation is as follows now:

$ stat <mount point>
  File: ‘<mount point>’
  Size: 0               Blocks: 1          IO Block: 4096   directory
Device: 2bh/43d Inode: 1           Links: 1
Access: (0777/drwxrwxrwx)  Uid: ( 9999/<user name>)   Gid: (  100/   users)
Access: 1970-01-01 00:00:00.000000000 +0000
Modify: 1970-01-01 00:00:00.000000000 +0000
Change: 1970-01-01 00:00:00.000000000 +0000
 Birth: -

The mount point is unixtime(0) for mtime / ctime / atime, and in 0777 as mode, and the user / group is as same as s3fs process's uid / gid.
These can be changed with the mp_umask option, but it does not retain stat information.

Changes

The mount point can be the root of the bucket or a directory under the bucket.

In the case of bucket root, a file(directory object) for stat information is created and stored in the bucket root.
Its path is / and the directory object is also /.
This matches usually the directory object(<directory name>/) that s3fs is currently creating for the directory. (/ means that the directory name is empty.)
In this case, the directory object will be /.

If the directory is under a bucket(ex. foo), the stat information will be used the stat information for that directory.
That is, it uses the information in the directory object(foo/).

By handling the stat information of the mount point, it has been modified so that operations such as chmod / chown / utimens etc commands can be performed.

When an operation is performed on the mount point via the s3fs process with this modification, the directory object is output/updated and the stat information is saved.

Notes

Once this PR is merged, I can post another PR which resolves for #1961 and #1962 issues.

Also, I think we can abolish(or deprecate) the mp_umask option.
If users allow it, I'll create a PR to abolish them later.


🔄 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/1964 **Author:** [@ggtakec](https://github.com/ggtakec) **Created:** 6/20/2022 **Status:** ✅ Merged **Merged:** 10/22/2022 **Merged by:** [@ggtakec](https://github.com/ggtakec) **Base:** `master` ← **Head:** `fix_root_stat` --- ### 📝 Commits (1) - [`c76b8c5`](https://github.com/s3fs-fuse/s3fs-fuse/commit/c76b8c55082e309af9d3bcc1ebd0d8b0deb5883c) Added stat information to the mount point ### 📊 Changes **2 files changed** (+263 additions, -90 deletions) <details> <summary>View changed files</summary> 📝 `src/s3fs.cpp` (+178 -90) 📝 `test/integration-test-main.sh` (+85 -0) </details> ### 📄 Description ### Relevant Issue (if applicable) #1961 #1962 ### Details **NOTE: This fix is a preliminary fix needed to resolve #1961 and #1962.** This PR allows user to retain the mount point's stat information. #### Background The mount point that s3fs mounts does not have stat information. Therefore, the situation is as follows now: ``` $ stat <mount point> File: ‘<mount point>’ Size: 0 Blocks: 1 IO Block: 4096 directory Device: 2bh/43d Inode: 1 Links: 1 Access: (0777/drwxrwxrwx) Uid: ( 9999/<user name>) Gid: ( 100/ users) Access: 1970-01-01 00:00:00.000000000 +0000 Modify: 1970-01-01 00:00:00.000000000 +0000 Change: 1970-01-01 00:00:00.000000000 +0000 Birth: - ``` The mount point is unixtime(0) for `mtime` / `ctime` / `atime`, and in `0777` as mode, and the `user` / `group` is as same as s3fs process's `uid` / `gid`. These can be changed with the `mp_umask` option, but it does not retain stat information. #### Changes The mount point can be the root of the bucket or a directory under the bucket. In the case of bucket root, a file(directory object) for stat information is created and stored in the bucket root. Its path is `/` and the directory object is also `/`. This matches usually the directory object(`<directory name>/`) that s3fs is currently creating for the directory. (`/` means that the directory name is empty.) In this case, the directory object will be `/`. If the directory is under a bucket(ex. `foo`), the stat information will be used the stat information for that directory. That is, it uses the information in the directory object(`foo/`). By handling the stat information of the mount point, it has been modified so that operations such as `chmod` / `chown` / `utimens` etc commands can be performed. When an operation is performed on the mount point via the s3fs process with this modification, the directory object is output/updated and the stat information is saved. #### Notes Once this PR is merged, I can post another PR which resolves for #1961 and #1962 issues. Also, I think we can abolish(or deprecate) the `mp_umask` option. If users allow it, I'll create a PR to abolish them later. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-04 02:04: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#2274
No description provided.