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@xxxxxxxxxxxxx> 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@xxxxxxxxxxxxx