From: Jan Kara <jack@suse.cz>
To: Lukas Czerner <lczerner@redhat.com>
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu, jlayton@kernel.org,
jack@suse.cz, linux-fsdevel@vger.kernel.org, ebiggers@kernel.org,
david@fromorbit.com, Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH v4 2/3] fs: record I_DIRTY_TIME even if inode already has I_DIRTY_INODE
Date: Wed, 24 Aug 2022 19:31:46 +0200 [thread overview]
Message-ID: <20220824173146.rza57sg5fuf2fc6b@quack3> (raw)
In-Reply-To: <20220824160349.39664-2-lczerner@redhat.com>
On Wed 24-08-22 18:03:48, Lukas Czerner wrote:
> Currently the I_DIRTY_TIME will never get set if the inode already has
> I_DIRTY_INODE with assumption that it supersedes I_DIRTY_TIME. That's
> true, however ext4 will only update the on-disk inode in
> ->dirty_inode(), not on actual writeback. As a result if the inode
> already has I_DIRTY_INODE state by the time we get to
> __mark_inode_dirty() only with I_DIRTY_TIME, the time was already filled
> into on-disk inode and will not get updated until the next I_DIRTY_INODE
> update, which might never come if we crash or get a power failure.
>
> The problem can be reproduced on ext4 by running xfstest generic/622
> with -o iversion mount option.
>
> Fix it by allowing I_DIRTY_TIME to be set even if the inode already has
> I_DIRTY_INODE. Also make sure that the case is properly handled in
> writeback_single_inode() as well. Additionally changes in
> xfs_fs_dirty_inode() was made to accommodate for I_DIRTY_TIME in flag.
>
> Thanks Jan Kara for suggestions on how to make this work properly.
>
> Cc: Dave Chinner <david@fromorbit.com>
> Cc: Christoph Hellwig <hch@infradead.org>
> Signed-off-by: Lukas Czerner <lczerner@redhat.com>
> Suggested-by: Jan Kara <jack@suse.cz>
Looks good to me. Feel free to add:
Reviewed-by: Jan Kara <jack@suse.cz>
Just two nits below:
> @@ -2369,6 +2374,17 @@ void __mark_inode_dirty(struct inode *inode, int flags)
> trace_writeback_mark_inode_dirty(inode, flags);
>
> if (flags & I_DIRTY_INODE) {
> +
Pointless empty line here.
> + /* Inode timestamp update will piggback on this dirtying */
Maybe expand this comment to:
/*
* Inode timestamp update will piggback on this dirtying.
* We tell ->dirty_inode callback that timestamps need to
* be updated by setting I_DIRTY_TIME in flags.
*/
> + if (inode->i_state & I_DIRTY_TIME) {
> + spin_lock(&inode->i_lock);
> + if (inode->i_state & I_DIRTY_TIME) {
> + inode->i_state &= ~I_DIRTY_TIME;
> + flags |= I_DIRTY_TIME;
> + }
> + spin_unlock(&inode->i_lock);
> + }
> +
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2022-08-24 17:32 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-24 16:03 [PATCH v4 1/3] ext4: don't increase iversion counter for ea_inodes Lukas Czerner
2022-08-24 16:03 ` [PATCH v4 2/3] fs: record I_DIRTY_TIME even if inode already has I_DIRTY_INODE Lukas Czerner
2022-08-24 17:31 ` Jan Kara [this message]
2022-08-25 10:06 ` [PATCH v5] " Lukas Czerner
2022-09-29 14:58 ` Theodore Ts'o
2022-08-24 16:03 ` [PATCH v4 3/3] ext4: unconditionally enable the i_version counter Lukas Czerner
2022-08-26 16:11 ` Jeff Layton
2022-08-29 8:17 ` Lukas Czerner
2022-08-29 10:16 ` Jeff Layton
2022-09-29 14:58 ` [PATCH v4 1/3] ext4: don't increase iversion counter for ea_inodes Theodore Ts'o
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=20220824173146.rza57sg5fuf2fc6b@quack3 \
--to=jack@suse.cz \
--cc=david@fromorbit.com \
--cc=ebiggers@kernel.org \
--cc=hch@infradead.org \
--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