Bug 15682 - Modified time of a file is not updated when the file is open.
Summary: Modified time of a file is not updated when the file is open.
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.15.13
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-15 04:14 UTC by amit.bhaira@panzura.com
Modified: 2024-07-15 04:14 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description amit.bhaira@panzura.com 2024-07-15 04:14:20 UTC
When a file is open and being written to by a client, executing the stat command on this file (by the same or a different client) results in the modified time reported by stat remaining unchanged from when the file was first opened. This could potentially be a bug or an intentional behavior, and further insights are needed to understand the cause.

Steps to Reproduce:

Setup:
    - Deploy an SMB server on an Ubuntu machine (this issue has been observed on Ubuntu but may also be reproducible on Windows).
    - Expose a share from the SMB server.
    - Mount the share using cifs on another Linux machine.
    - Use the following Python script to keep the file open and write to it:
    import time
   
    file_name = "/mnt/<location>/a.txt"
    char_to_write = "a"
   
    with open(file_name, "a") as file:
        while True:
            file.write(char_to_write)
            file.flush()
            print(".")
            time.sleep(1)

    - While the above script is running, execute stat on the file from the same client or any other client that has the share mounted:
   stat /mnt/<location>/a.txt        
    - Observe that even though the file is being written to, its modified time does not get updated.