Lukas Czerner cbfecb927f fs: record I_DIRTY_TIME even if inode already has I_DIRTY_INODE
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>
Cc: stable@kernel.org
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Suggested-by: Jan Kara <jack@suse.cz>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20220825100657.44217-1-lczerner@redhat.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2022-09-29 23:02:00 -04:00
..
2022-01-15 16:30:29 +02:00
2021-10-22 16:00:31 -07:00
2022-04-26 13:34:42 +10:00
2022-07-22 10:58:39 -07:00
2022-05-11 17:01:23 +10:00
2022-08-13 13:50:11 -07:00
2022-05-11 17:01:22 +10:00
2022-06-23 13:34:38 -07:00
2022-07-17 17:14:32 -07:00
2022-08-04 20:19:16 -07:00
2022-08-04 20:19:16 -07:00
2022-08-13 13:50:11 -07:00
2022-08-13 13:50:11 -07:00
2022-05-11 17:01:22 +10:00
2022-05-11 17:01:22 +10:00
2022-07-14 09:46:37 -07:00
2021-08-19 10:07:14 -07:00