From: Christian Brauner <brauner@kernel.org>
To: Jeff Layton <jlayton@kernel.org>
Cc: tytso@mit.edu, adilger.kernel@dilger.ca,
linux-ext4@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Lukas Czerner <lczerner@redhat.com>, Jan Kara <jack@suse.cz>
Subject: Re: [PATCH] ext4: fix i_version handling in ext4
Date: Tue, 16 Aug 2022 15:46:43 +0200 [thread overview]
Message-ID: <20220816134643.gpdj4pmih3txzhto@wittgenstein> (raw)
In-Reply-To: <46ecd0f938ecdc508505456f76e767e0ffcc7137.camel@kernel.org>
On Tue, Aug 16, 2022 at 09:43:16AM -0400, Jeff Layton wrote:
> On Tue, 2022-08-16 at 15:33 +0200, Christian Brauner wrote:
> > On Tue, Aug 16, 2022 at 09:15:22AM -0400, Jeff Layton wrote:
> > > ext4 currently updates the i_version counter when the atime is updated
> > > during a read. This is less than ideal as it can cause unnecessary cache
> > > invalidations with NFSv4. The increment in ext4_mark_iloc_dirty is also
> > > problematic since it can also corrupt the i_version counter for
> > > ea_inodes.
> > >
> > > We aren't bumping the file times in ext4_mark_iloc_dirty, so changing
> > > the i_version there seems wrong, and is the cause of both problems.
> > > Remove that callsite and add increments to the setattr and setxattr
> > > codepaths (at the same time that we update the ctime). The i_version
> > > bump that already happens during timestamp updates should take care of
> > > the rest.
> > >
> > > Cc: Lukas Czerner <lczerner@redhat.com>
> > > Cc: Jan Kara <jack@suse.cz>
> > > Cc: Christian Brauner <brauner@kernel.org>
> > > Signed-off-by: Jeff Layton <jlayton@kernel.org>
> > > ---
> >
> > Seems good to me. But it seems that the xfs patch you sent does have
> > inode_inc_version() right after setattr_copy() as well. So I wonder if
> > we couldn't just try and move inode_inc_version() into setattr_copy()
> > itself.
> >
>
> We probably could, but setattr_copy has a lot of callers and most
> filesystems don't need this. Also, there are some cases where we don't
> want to update the i_version after a setattr.
>
> In particular, if you do a truncate and the size doesn't change, then
> you really don't want to update the timestamps (and therefore the
> i_version shouldn't change either).
We could probably all handle that with some massaging but I'm also fine
with doing it just for ext4 and xfs if these are the only ones where
this is relevant:
Reviewed-by: Christian Brauner (Microsoft) <brauner@kernel.org>
next prev parent reply other threads:[~2022-08-16 13:47 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-16 13:15 [PATCH] ext4: fix i_version handling in ext4 Jeff Layton
2022-08-16 13:33 ` Christian Brauner
2022-08-16 13:43 ` Jeff Layton
2022-08-16 13:46 ` Christian Brauner [this message]
2022-08-17 13:04 ` Jan Kara
2022-08-17 13:09 ` Jeff Layton
2022-08-17 13:25 ` Jan Kara
2022-08-17 13:28 ` Jeff Layton
2022-08-17 13:47 ` Jan Kara
-- strict thread matches above, loose matches on Subject: below --
2022-08-19 11:36 Jeff Layton
2022-08-19 11:40 ` Jeff Layton
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=20220816134643.gpdj4pmih3txzhto@wittgenstein \
--to=brauner@kernel.org \
--cc=adilger.kernel@dilger.ca \
--cc=jack@suse.cz \
--cc=jlayton@kernel.org \
--cc=lczerner@redhat.com \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=tytso@mit.edu \
/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