lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220824173146.rza57sg5fuf2fc6b@quack3>
Date:   Wed, 24 Aug 2022 19:31:46 +0200
From:   Jan Kara <jack@...e.cz>
To:     Lukas Czerner <lczerner@...hat.com>
Cc:     linux-ext4@...r.kernel.org, tytso@....edu, jlayton@...nel.org,
        jack@...e.cz, linux-fsdevel@...r.kernel.org, ebiggers@...nel.org,
        david@...morbit.com, Christoph Hellwig <hch@...radead.org>
Subject: Re: [PATCH v4 2/3] fs: record I_DIRTY_TIME even if inode already has
 I_DIRTY_INODE

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@...morbit.com>
> Cc: Christoph Hellwig <hch@...radead.org>
> Signed-off-by: Lukas Czerner <lczerner@...hat.com>
> Suggested-by: Jan Kara <jack@...e.cz>

Looks good to me. Feel free to add:

Reviewed-by: Jan Kara <jack@...e.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@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ