Linux-Fsdevel Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Yafang Shao <laoar.shao@gmail.com>
Cc: Matthew Wilcox <willy@infradead.org>,
	Christoph Hellwig <hch@infradead.org>,
	"Darrick J. Wong" <darrick.wong@oracle.com>,
	Michal Hocko <mhocko@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Linux MM <linux-mm@kvack.org>
Subject: Re: [PATCH v7 2/2] xfs: avoid transaction reservation recursion
Date: Thu, 27 Aug 2020 12:42:48 +1000	[thread overview]
Message-ID: <20200827024248.GA12131@dread.disaster.area> (raw)
In-Reply-To: <CALOAHbA3Twne1ebM+tMZQPCJkL9ghpeeMJXPRjPX=iz8X9=LJA@mail.gmail.com>

On Thu, Aug 27, 2020 at 10:13:15AM +0800, Yafang Shao wrote:
> On Thu, Aug 27, 2020 at 9:58 AM Matthew Wilcox <willy@infradead.org> wrote:
> >
> > On Thu, Aug 27, 2020 at 09:34:44AM +0800, Yafang Shao wrote:
> > > @@ -1500,9 +1500,9 @@ iomap_do_writepage(struct page *page, struct writeback_control *wbc, void *data)
> > >
> > >       /*
> > >        * Given that we do not allow direct reclaim to call us, we should
> > > -      * never be called in a recursive filesystem reclaim context.
> > > +      * never be called while in a filesystem transaction.
> > >        */
> > > -     if (WARN_ON_ONCE(current->flags & PF_MEMALLOC_NOFS))
> > > +     if (WARN_ON_ONCE(wbc->fstrans_recursion))
> > >               goto redirty;
> >
> > Erm, Dave said:
> >
> > > I think we should just remove
> > > the check completely from iomap_writepage() and move it up into
> > > xfs_vm_writepage() and xfs_vm_writepages().
> >
> > ie everywhere you set this new bit, just check current->journal_info.
> 
> 
> I can't get you. Would you pls. be more specific ?
> 
> I move the check of current->journal into xfs_vm_writepage() and
> xfs_vm_writepages(), and I think that is the easiest way to implement
> it.
> 
>        /* we abort the update if there was an IO error */
> @@ -564,6 +565,9 @@ xfs_vm_writepage(
>  {
>         struct xfs_writepage_ctx wpc = { };
> 
> +       if (xfs_trans_context_active())
> +               wbc->fstrans_recursion = 1;    <<< set for XFS only.
> +
>         return iomap_writepage(page, wbc, &wpc.ctx, &xfs_writeback_ops);

Get rid of wbc->fstrans_recursion. Just do

	if (WARN_ON_ONCE(current->journal_info))
		.....

right here in the XFS code.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2020-08-27  2:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-27  1:34 [PATCH v7 0/2] avoid xfs " Yafang Shao
2020-08-27  1:34 ` [PATCH v7 1/2] mm: Add become_kswapd and restore_kswapd Yafang Shao
2020-08-27  1:34 ` [PATCH v7 2/2] xfs: avoid transaction reservation recursion Yafang Shao
2020-08-27  1:58   ` Matthew Wilcox
2020-08-27  2:13     ` Yafang Shao
2020-08-27  2:42       ` Dave Chinner [this message]
2020-08-27  2:59         ` Yafang Shao

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=20200827024248.GA12131@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=akpm@linux-foundation.org \
    --cc=darrick.wong@oracle.com \
    --cc=hch@infradead.org \
    --cc=laoar.shao@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=mhocko@kernel.org \
    --cc=willy@infradead.org \
    --subject='Re: [PATCH v7 2/2] xfs: avoid transaction reservation recursion' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).