linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] don't update atime on file write...
@ 2017-10-30 19:02 Mike Marshall
  2017-10-30 21:54 ` Dave Chinner
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Marshall @ 2017-10-30 19:02 UTC (permalink / raw)
  To: linux-fsdevel, Mike Marshall, Martin Brandenburg

I've been working with xfstests generic/003. It contains
numerous tests.

For example, we were updating atime on a directory when a
new file was created in the directory. It "makes sense",
but it was easy to google "open posix" and see that it was
wrong:

  If O_CREAT is set and the file did not previously exist, upon
  successful completion, open() shall mark for update the st_atime,
  st_ctime, and st_mtime fields of the file and the st_ctime and
  st_mtime fields of the parent directory.

We fixed the above in the server.

Another thing we've been doing wrong is to update atime
when a file is modified.

Google "write posix" to the rescue again:

  Upon successful completion, where nbyte is greater than 0, write()
  shall mark for update the st_ctime and st_mtime fields of the file,
  and if the file is a regular file, the S_ISUID and S_ISGID bits
  of the file mode may be cleared.

This makes the test pass, and I don't see that it has any bad
side effects, does it seem OK to you all?

diff --git a/fs/orangefs/file.c b/fs/orangefs/file.c
index 336ecbf..009fce0 100644
--- a/fs/orangefs/file.c
+++ b/fs/orangefs/file.c
@@ -384,7 +384,9 @@ static ssize_t do_readv_writev(enum
ORANGEFS_io_type type, struct file *file,
                } else {
                        SetMtimeFlag(orangefs_inode);
                        inode->i_mtime = current_time(inode);
+/*
                        mark_inode_dirty_sync(inode);
+*/
                }
        }

-Mike

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-11-07 20:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-30 19:02 [RFC] don't update atime on file write Mike Marshall
2017-10-30 21:54 ` Dave Chinner
2017-11-07 20:01   ` [PATCH] orangefs: stop setting atime on inode dirty Martin Brandenburg
2017-11-07 20:23   ` [RFC] don't update atime on file write Mike Marshall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).