0

I am designing a filesystem to be implemented in FUSE. I have a question regarding what is allowed and best practice. There are 2 scenarios:

  • User process calls open(..., O_NOATIME). Filesystem updates atime anyway. Is this safe?
  • User process calls open(...) without O_NOATIME. Filesystem forgets to update atime. Is this safe?

Assume that new atime is written to disk only if also other important attributes have changed. Therefore sometimes an update may follow, sometimes not.

Filesystem would have no mount parameters for changing behaviour. Behaviour described above would be default and mandatory.

1 Answer 1

1

From man 2 open:

O_NOATIME (since Linux 2.6.8)
       Do  not update the file last access time (st_atime in the inode)
       when the file is read(2).  This flag  is  intended  for  use  by
       indexing  or  backup  programs,  where its use can significantly
       reduce the amount of disk activity.  This flag may not be effec‐
       tive  on  all filesystems.  One example is NFS, where the server
       maintains the access time.

So the flag makes no guarantees that it will be respected and is explicitly called out as only really being important for reducing disk activity.

Sounds like you will be fine for scenario 1 where you update it anyway.

As for scenario 2, you should still be fine. Filesystems can be mounted with a noatime flag that prevents atime from being updated. So user code cannot assume that it absolutely will be updated.

1
  • 1
    There is not much remaining software that requires ATIME, but it does exist. Mutt is (was? is it still?) an example as it used it to determine what hadn't been viewed before. As long as it's documented adequately then it's fair for a given filesystem not to support a feature IMHO. Apr 15, 2015 at 2:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .