# Re: \[PATCH 01/13\] fs: avoid double-writing inodes on lazytime expiration

- From: Matthew Wilcox \<willy@infradead.org\>
- Date: 2021-01-08 20:39:36 
- List: stable
- Page: https://ratatoskr.run/stable/2021/01/196891
- Thread: https://ratatoskr.run/linux-fsdevel/2021/01/196640/t.md

```text
On Thu, Jan 07, 2021 at 03:47:09PM +0100, Jan Kara wrote:
> I think attached patch (compile-tested only) should actually fix the
> problem as well without this special ->dirty_inode() call. It basically
> only moves the mark_inode_dirty_sync() before inode->i_state clearing.
> Because conceptually mark_inode_dirty_sync() is IMO the right function to
> call. It will take care of clearing I_DIRTY_TIME flag (because we are
> setting I_DIRTY_SYNC), it will also not touch inode->i_io_list if the inode
> is queued for sync (I_SYNC_QUEUED is set in that case). The only problem
> with calling it was that it was called *after* clearing dirty bits from
> i_state... What do you think?

I like this patch far more, fwiw.

```
