From: Dave Chinner <david@fromorbit.com>
To: Mike Marshall <hubcap@omnibond.com>
Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Mike Marshall <hubcap@clemson.edu>,
Martin Brandenburg <martin@omnibond.com>
Subject: Re: [RFC] don't update atime on file write...
Date: Tue, 31 Oct 2017 08:54:40 +1100 [thread overview]
Message-ID: <20171030215440.GC5858@dastard> (raw)
In-Reply-To: <CAOg9mSRocroyX=1xbEVsPbcxziow=cmpmH4jc2pn0syUx9CqnQ@mail.gmail.com>
On Mon, Oct 30, 2017 at 03:02:06PM -0400, Mike Marshall wrote:
> 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);
> +*/
That'll break dirty inode tracking. Your problem here is an
orangefs issue:
mark_inode_dirty_sync
__mark_inode_dirty
->dirty_inode
orangefs_dirty_inode
SetAtimeFlag(orangefs_inode);
i.e. every time the inode is dirtied for data, metadata or
timestamps, orangefs is updating atime.
If you need to do something whenever the kernel updates atime (or
c/mtime), then implement ->update_time....
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2017-10-30 21:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-30 19:02 [RFC] don't update atime on file write Mike Marshall
2017-10-30 21:54 ` Dave Chinner [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171030215440.GC5858@dastard \
--to=david@fromorbit.com \
--cc=hubcap@clemson.edu \
--cc=hubcap@omnibond.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=martin@omnibond.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).