On Tue, Dec 8, 2020 at 10:42 AM Matthew Wilcox <willy@xxxxxxxxxxxxx> wrote: > > On Tue, Dec 08, 2020 at 10:15:43AM +0800, Yafang Shao wrote: > > - /* > > - * Given that we do not allow direct reclaim to call us, we should > > - * never be called in a recursive filesystem reclaim context. > > - */ > > - if (WARN_ON_ONCE(current->flags & PF_MEMALLOC_NOFS)) > > - goto redirty; > > - > > /* > > * Is this page beyond the end of the file? > > * > > diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c > > index 2371187b7615..28db93d0da97 100644 > > --- a/fs/xfs/xfs_aops.c > > +++ b/fs/xfs/xfs_aops.c > > @@ -568,6 +568,16 @@ xfs_vm_writepage( > > { > > struct xfs_writepage_ctx wpc = { }; > > > > + /* > > + * Given that we do not allow direct reclaim to call us, we should > > + * never be called while in a filesystem transaction. > > + */ > > + if (xfs_trans_context_active()) { > > + redirty_page_for_writepage(wbc, page); > > + unlock_page(page); > > + return 0; > > + } > > Dave specifically asked for this one to WARN too. I put the warn in xfs_trans_context_active(), pls. see the definition of it. Is that okay ? -- Thanks Yafang