public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Christoph Hellwig <hch@lst.de>
Cc: brauner@kernel.org, viro@zeniv.linux.org.uk, jack@suse.cz,
	 linux-fsdevel@vger.kernel.org, linux-xfs@vger.kernel.org
Subject: Re: [PATCH] fs: clear I_DIRTY_TIME in sync_lazytime
Date: Wed, 18 Mar 2026 18:34:51 +0100	[thread overview]
Message-ID: <my7zbzcijl7w3waamiow6qsfjjoo6gpxx4izvpyhfjxhvp5vnu@ahonzibzgjpa> (raw)
In-Reply-To: <20260317134409.1691317-1-hch@lst.de>

On Tue 17-03-26 14:44:04, Christoph Hellwig wrote:
> For file systems implementing ->sync_lazytime, I_DIRTY_TIME fails to get
> cleared in sync_lazytime, and might cause additional calls to
> sync_lazytime during inode deactivation.  Use the same pattern as in
> __mark_inode_dirty to clear the flag under the inode lock.
> 
> Fixes: 5cf06ea56ee6 ("fs: add a ->sync_lazytime method")
> Signed-off-by: Christoph Hellwig <hch@lst.de>

Looks good. Feel free to add:

Reviewed-by: Jan Kara <jack@suse.cz>

								Honza

> ---
>  fs/fs-writeback.c | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
> index 7c75ed7e8979..d8dac1931595 100644
> --- a/fs/fs-writeback.c
> +++ b/fs/fs-writeback.c
> @@ -1711,6 +1711,19 @@ static void requeue_inode(struct inode *inode, struct bdi_writeback *wb,
>  	}
>  }
>  
> +static bool __sync_lazytime(struct inode *inode)
> +{
> +	spin_lock(&inode->i_lock);
> +	if (!(inode_state_read(inode) & I_DIRTY_TIME)) {
> +		spin_unlock(&inode->i_lock);
> +		return false;
> +	}
> +	inode_state_clear(inode, I_DIRTY_TIME);
> +	spin_unlock(&inode->i_lock);
> +	inode->i_op->sync_lazytime(inode);
> +	return true;
> +}
> +
>  bool sync_lazytime(struct inode *inode)
>  {
>  	if (!(inode_state_read_once(inode) & I_DIRTY_TIME))
> @@ -1718,9 +1731,8 @@ bool sync_lazytime(struct inode *inode)
>  
>  	trace_writeback_lazytime(inode);
>  	if (inode->i_op->sync_lazytime)
> -		inode->i_op->sync_lazytime(inode);
> -	else
> -		mark_inode_dirty_sync(inode);
> +		return __sync_lazytime(inode);
> +	mark_inode_dirty_sync(inode);
>  	return true;
>  }
>  
> -- 
> 2.47.3
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

      parent reply	other threads:[~2026-03-18 17:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-17 13:44 [PATCH] fs: clear I_DIRTY_TIME in sync_lazytime Christoph Hellwig
2026-03-17 14:12 ` Christian Brauner
2026-03-18 17:34 ` Jan Kara [this message]

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=my7zbzcijl7w3waamiow6qsfjjoo6gpxx4izvpyhfjxhvp5vnu@ahonzibzgjpa \
    --to=jack@suse.cz \
    --cc=brauner@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /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