Opened 6 years ago

Closed 2 years ago

#9834 closed bug (fixed)

bfs sends spurious B_STAT_MODIFICATION_TIME notifications after file change

Reported by: bonefish Owned by: axeld
Priority: normal Milestone: R1
Component: File Systems/BFS Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: All

Description

After a file has been changed (or just touched) BFS starts sending out B_STAT_MODIFICATION_TIME whenever the file is closed after opening it for writing, even if the file wasn't modified. Can be reproduced with the attached test programs:

  • Start monitoring a file that hasn't been changed in this session, yet:
    modified_time_monitor /path/to/file
    
  • Verify that no spurious notification are sent yet (the test program waits 3s before closing the file):
    open_for_writing /path/to/file
    
  • Touch the file. Notifications are received as expected.
  • Run open_for_writing again. This time after close() a spurious notification is received.

Tested in the package-management branch, which corresponds to master hrev45747.

Attachments (2)

modified_time_monitor.cpp (1.4 KB) - added by bonefish 6 years ago.
open_for_writing.cpp (420 bytes) - added by bonefish 6 years ago.

Download all attachments as: .zip

Change History (6)

Changed 6 years ago by bonefish

Attachment: modified_time_monitor.cpp added

Changed 6 years ago by bonefish

Attachment: open_for_writing.cpp added

comment:1 Changed 6 years ago by axeld

Can't reproduce with the steps you mentioned in hrev45817.

In theory this can happen if either Inode::fOldLastModified is not correctly maintained at some place, or if updating the last modified index failed, as that's fOldLastModified's main purpose.

Do you by any chance reproduce this on a volume without indices?

comment:2 Changed 6 years ago by axeld

Can you try to remove line 381 from Index.cpp (http://cgit.haiku-os.org/haiku/tree/src/add-ons/kernel/file_systems/bfs/Index.cpp#n381)? I think that should fix your issue, in case it's really related to a volume without indices.

comment:3 Changed 6 years ago by bonefish

Confirmed that the issue only occurs with a volume without indices and that the suggested change fixes it.

comment:4 Changed 2 years ago by axeld

Resolution: fixed
Status: newclosed

Fixed in hrev50874. Obviously needed some time to think it over :-)

Note: See TracTickets for help on using tickets.