All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Jing Xia <jing.xia@unisoc.com>
Cc: viro@zeniv.linux.org.uk, jack@suse.cz, hch@lst.de,
	jing.xia.mail@gmail.com, stable@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH V2] writeback: Avoid skipping inode writeback
Date: Tue, 10 May 2022 12:06:06 +0200	[thread overview]
Message-ID: <20220510100606.qqiiti2i3axfusnh@quack3.lan> (raw)
In-Reply-To: <20220510023514.27399-1-jing.xia@unisoc.com>

On Tue 10-05-22 10:35:14, Jing Xia wrote:
> We have run into an issue that a task gets stuck in
> balance_dirty_pages_ratelimited() when perform I/O stress testing.
> The reason we observed is that an I_DIRTY_PAGES inode with lots
> of dirty pages is in b_dirty_time list and standard background
> writeback cannot writeback the inode.
> After studing the relevant code, the following scenario may lead
> to the issue:
> 
> task1                                   task2
> -----                                   -----
> fuse_flush
>  write_inode_now //in b_dirty_time
>   writeback_single_inode
>    __writeback_single_inode
>                                  fuse_write_end
>                                   filemap_dirty_folio
>                                    __xa_set_mark:PAGECACHE_TAG_DIRTY
>     lock inode->i_lock
>     if mapping tagged PAGECACHE_TAG_DIRTY
>     inode->i_state |= I_DIRTY_PAGES
>     unlock inode->i_lock
>                                    __mark_inode_dirty:I_DIRTY_PAGES
>                                       lock inode->i_lock
>                                       -was dirty,inode stays in
>                                       -b_dirty_time
>                                       unlock inode->i_lock
> 
>    if(!(inode->i_state & I_DIRTY_All))
>       -not true,so nothing done
> 
> This patch moves the dirty inode to b_dirty list when the inode
> currently is not queued in b_io or b_more_io list at the end of
> writeback_single_inode.
> 
> Reviewed-by: Jan Kara <jack@suse.cz>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> CC: stable@vger.kernel.org
> Fixes: 0ae45f63d4ef ("vfs: add support for a lazytime mount option")
> Signed-off-by: Jing Xia <jing.xia@unisoc.com>

Thanks. I've queued the patch to my tree and will push it to Linus tomorrow
or so.

								Honza

> ---
>  fs/fs-writeback.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
> index 591fe9cf1659..1fae0196292a 100644
> --- a/fs/fs-writeback.c
> +++ b/fs/fs-writeback.c
> @@ -1712,6 +1712,10 @@ static int writeback_single_inode(struct inode *inode,
>  	 */
>  	if (!(inode->i_state & I_DIRTY_ALL))
>  		inode_cgwb_move_to_attached(inode, wb);
> +	else if (!(inode->i_state & I_SYNC_QUEUED) &&
> +		 (inode->i_state & I_DIRTY))
> +		redirty_tail_locked(inode, wb);
> +
>  	spin_unlock(&wb->list_lock);
>  	inode_sync_complete(inode);
>  out:
> -- 
> 2.17.1
> 
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

      reply	other threads:[~2022-05-10 10:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-10  2:35 [PATCH V2] writeback: Avoid skipping inode writeback Jing Xia
2022-05-10 10:06 ` 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=20220510100606.qqiiti2i3axfusnh@quack3.lan \
    --to=jack@suse.cz \
    --cc=hch@lst.de \
    --cc=jing.xia.mail@gmail.com \
    --cc=jing.xia@unisoc.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.