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  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]
Date:   Fri, 5 Aug 2022 14:23:06 +0200
From:   Lukas Czerner <>
To:     Eric Biggers <>
Cc:,,,, Dave Chinner <>,
        Christoph Hellwig <>, Jan Kara <>
Subject: Re: [PATCH v2 2/3] fs: record I_DIRTY_TIME even if inode already has

On Fri, Aug 05, 2022 at 01:05:45AM -0700, Eric Biggers wrote:
> On Wed, Aug 03, 2022 at 12:53:39PM +0200, Lukas Czerner wrote:
> > diff --git a/include/linux/fs.h b/include/linux/fs.h
> > index 9ad5e3520fae..2243797badf2 100644
> > --- a/include/linux/fs.h
> > +++ b/include/linux/fs.h
> > @@ -2245,9 +2245,9 @@ static inline void kiocb_clone(struct kiocb *kiocb, struct kiocb *kiocb_src,
> >   *			The inode itself only has dirty timestamps, and the
> >   *			lazytime mount option is enabled.  We keep track of this
> >   *			separately from I_DIRTY_SYNC in order to implement
> >   *			lazytime.  This gets cleared if I_DIRTY_INODE
> > - *			(I_DIRTY_SYNC and/or I_DIRTY_DATASYNC) gets set.  I.e.
> > - *			either I_DIRTY_TIME *or* I_DIRTY_INODE can be set in
> > - *			i_state, but not both.  I_DIRTY_PAGES may still be set.
> > + *			(I_DIRTY_SYNC and/or I_DIRTY_DATASYNC) gets set. But
> > + *			I_DIRTY_TIME can still be set if I_DIRTY_SYNC is already
> > + *			in place.
> I'm still having a hard time understanding the new semantics.  The first
> sentence above needs to be updated since I_DIRTY_TIME no longer means "the inode
> itself only has dirty timestamps", right?

The problem is that it was always assumed that I_DIRTY_INODE superseeds
I_DIRTY_TIME and so it would get cleared in __mark_inode_dirty() when we
have I_DIRTY_INODE. That's true, we call sb->s_op->dirty_inode(), the
time update gets pushed into on-disk inode structure, I_DIRTY_TIME
cleared and it will get queued for writeback.

Any subsequent dirtying with I_DIRTY_TIME gets ignored simply because
I_DIRTY_INODE is already set in i_state. But in ext4 this time update
will never get pushed into on disk inode and there is no I_DIRTY_TIME so
once the writeback is done we've lost all those I_DIRTY_TIME updates in
between even if there was a sync.

Now, we still clear I_DIRTY_TIME when we get I_DIRTY_INODE, but any
subsequent I_DIRTY_TIME only updates won't be ignored and we set it into
i_state. After the writeback is done it'll be moved to b_dirty_time

So I am not sure how would you like it to be re-worded, simply removing
the 'only' would be ok?

> Also, have you checked all the places that I_DIRTY_TIME is used and verified
> they do the right thing now?  What about inode_is_dirtytime_only()?

Yes, that's fine, despite the slightly misleading name ;)

> Also what is the precise meaning of the flags argument to ->dirty_inode now?
> 	sb->s_op->dirty_inode(inode,
> 			flags & (I_DIRTY_INODE | I_DIRTY_TIME));
> Note that dirty_inode is documented in Documentation/filesystems/vfs.rst.

Don't know. It alredy don't mention I_DIRTY_SYNC that can be there as
well. Additionaly it can have I_DIRTY_TIME to inform the fs we have a
dirty timestamp as well (in case of lazytime).

Perhaps we can add:

If the inode has dirty timestamp and lazytime is enabled I_DIRTY_TIME
will be set in the flags.


> - Eric

Powered by blists - more mailing lists