[GH-ISSUE #2264] Only when refreshing the directory, the meta information(timestamp) of files in that directory will be updated #1139

Closed
opened 2026-03-04 01:51:41 +03:00 by kerem · 2 comments
Owner

Originally created by @jestiny0 on GitHub (Aug 14, 2023).
Original GitHub issue: https://github.com/s3fs-fuse/s3fs-fuse/issues/2264

Additional Information

Version of s3fs being used (s3fs --version)

V1.86

Version of fuse being used (pkg-config --modversion fuse, rpm -qi fuse or dpkg -s fuse)

2.9.9-3

Kernel information (uname -r)

5.15.0-1040-aws

GNU/Linux Distribution, if applicable (cat /etc/os-release)

NAME="Ubuntu"
VERSION="20.04.2 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.2 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

How to run s3fs, if applicable

mkdir /models-s3 && echo xxx > /passwd-s3fs && chmod 600 /passwd-s3fs && s3fs model /models-s3 -o passwd_file=/passwd-s3fs

Details about issue

image

I have a Java program that checks the timestamp and size of a certain file to determine whether to reload the file. The core code is as follows:

File f = new File("vocab");
        long lastModify = f.lastModified();
        long size = f.length();
        System.out.println(lastModify);
        System.out.println(size);

Problem Reproduction:

  1. Run the Java program and find that the file's timestamp is 1.
  2. Use the "ls" command on the file in the directory and find that the timestamp is 1 (it should actually be 2).
  3. Use the "ls" command on the directory and find that the timestamp becomes 2.
  4. Use the "ls" command on the file and find that the timestamp also becomes 2.
  5. Run the Java program again, and the timestamp is successfully changed to 2
Originally created by @jestiny0 on GitHub (Aug 14, 2023). Original GitHub issue: https://github.com/s3fs-fuse/s3fs-fuse/issues/2264 <!-- -------------------------------------------------------------------------- The following information is very important in order to help us to help you. Omission of the following details may delay your support request or receive no attention at all. Keep in mind that the commands we provide to retrieve information are oriented to GNU/Linux Distributions, so you could need to use others if you use s3fs on macOS or BSD. --------------------------------------------------------------------------- --> ### Additional Information #### Version of s3fs being used (`s3fs --version`) <!-- example: V1.91 (commit:b19262a) --> V1.86 #### Version of fuse being used (`pkg-config --modversion fuse`, `rpm -qi fuse` or `dpkg -s fuse`) <!-- example: 2.9.2 --> 2.9.9-3 #### Kernel information (`uname -r`) <!-- example: 5.10.96-90.460.amzn2.x86_64 --> 5.15.0-1040-aws #### GNU/Linux Distribution, if applicable (`cat /etc/os-release`) <!-- command result --> NAME="Ubuntu" VERSION="20.04.2 LTS (Focal Fossa)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.04.2 LTS" VERSION_ID="20.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=focal UBUNTU_CODENAME=focal #### How to run s3fs, if applicable `mkdir /models-s3 && echo xxx > /passwd-s3fs && chmod 600 /passwd-s3fs && s3fs model /models-s3 -o passwd_file=/passwd-s3fs` ### Details about issue <!-- Please describe the content of the issue in detail. --> <img width="1110" alt="image" src="https://github.com/s3fs-fuse/s3fs-fuse/assets/105039245/130ed2bd-3248-4bfe-9ba6-6eba3893c192"> I have a Java program that checks the timestamp and size of a certain file to determine whether to reload the file. The core code is as follows: ``` File f = new File("vocab"); long lastModify = f.lastModified(); long size = f.length(); System.out.println(lastModify); System.out.println(size); ``` Problem Reproduction: 1. Run the Java program and find that the file's timestamp is 1. 2. Use the "ls" command on the file in the directory and find that the timestamp is 1 (it should actually be 2). 3. Use the "ls" command on the directory and find that the timestamp becomes 2. 4. Use the "ls" command on the file and find that the timestamp also becomes 2. 5. Run the Java program again, and the timestamp is successfully changed to 2
kerem closed this issue 2026-03-04 01:51:42 +03:00
Author
Owner

@gaul commented on GitHub (Aug 14, 2023):

1.86 has no default time limit for caching metadata. If you set -o stat_cache_expire=900 then it will only be cached for 15 minutes. 1.89 and later set this value by default.

<!-- gh-comment-id:1677142474 --> @gaul commented on GitHub (Aug 14, 2023): 1.86 has no default time limit for caching metadata. If you set `-o stat_cache_expire=900` then it will only be cached for 15 minutes. 1.89 and later set this value by default.
Author
Owner

@jestiny0 commented on GitHub (Aug 15, 2023):

Fixed! Thanks for your reply

<!-- gh-comment-id:1678516367 --> @jestiny0 commented on GitHub (Aug 15, 2023): Fixed! Thanks for your reply
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#1139
No description provided.