All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roman Gushchin <guro@fb.com>
To: Matthew Wilcox <willy@infradead.org>
Cc: "Darrick J. Wong" <djwong@kernel.org>,
	Murphy Zhou <jencce.kernel@gmail.com>,
	Linux-Fsdevel <linux-fsdevel@vger.kernel.org>,
	Linux MM <linux-mm@kvack.org>
Subject: Re: [fsdax xfs] Regression panic at inode_switch_wbs_work_fn
Date: Sun, 18 Jul 2021 09:07:41 -0700	[thread overview]
Message-ID: <YPRRzS+WaQebrHmz@carbon.lan> (raw)
In-Reply-To: <YPNnCItyLXWb3/dB@casper.infradead.org>

On Sun, Jul 18, 2021 at 12:26:00AM +0100, Matthew Wilcox wrote:
> On Sat, Jul 17, 2021 at 03:08:28PM -0700, Roman Gushchin wrote:
> > On Sat, Jul 17, 2021 at 10:17:13AM -0700, Darrick J. Wong wrote:
> > > On Fri, Jul 16, 2021 at 01:13:05PM -0700, Roman Gushchin wrote:
> > > > On Fri, Jul 16, 2021 at 01:57:55PM +0800, Murphy Zhou wrote:
> > > > > Hi,
> > > > > 
> > > > > On Fri, Jul 16, 2021 at 12:07 AM Roman Gushchin <guro@fb.com> wrote:
> > > > > >
> > > > > > On Thu, Jul 15, 2021 at 06:10:22PM +0800, Murphy Zhou wrote:
> > > > > > > Hi,
> > > > > > >
> > > > > > > #Looping generic/270 of xfstests[1] on pmem ramdisk with
> > > > > > > mount option:  -o dax=always
> > > > > > > mkfs.xfs option: -f -b size=4096 -m reflink=0
> > > > > > > can hit this panic now.
> > > > > > >
> > > > > > > #It's not reproducible on ext4.
> > > > > > > #It's not reproducible without dax=always.
> > > > > >
> > > > > > Hi Murphy!
> > > > > >
> > > > > > Thank you for the report!
> > > > > >
> > > > > > Can you, please, check if the following patch fixes the problem?
> > > > > 
> > > > > No. Still the same panic.
> > > > 
> > > > Hm, can you, please, double check this? It seems that the patch fixes the
> > > > problem for others (of course, it can be a different problem).
> > > > CCed you on the proper patch, just sent to the list.
> > > > 
> > > > Otherwise, can you, please, say on which line of code the panic happens?
> > > > (using addr2line utility, for example)
> > > 
> > > I experience the same problem that Murphy does, and I tracked it down
> > > to this chunk of inode_do_switch_wbs:
> > > 
> > > 	/*
> > > 	 * Count and transfer stats.  Note that PAGECACHE_TAG_DIRTY points
> > > 	 * to possibly dirty pages while PAGECACHE_TAG_WRITEBACK points to
> > > 	 * pages actually under writeback.
> > > 	 */
> > > 	xas_for_each_marked(&xas, page, ULONG_MAX, PAGECACHE_TAG_DIRTY) {
> > > here >>>>>>>>>> if (PageDirty(page)) {
> > > 			dec_wb_stat(old_wb, WB_RECLAIMABLE);
> > > 			inc_wb_stat(new_wb, WB_RECLAIMABLE);
> > > 		}
> > > 	}
> > > 
> > > I suspect that "page" is really a pfn to a pmem mapping and not a real
> > > struct page.
> > 
> > Good catch! Now it's clear that it's a different issue.
> > 
> > I think as now the best option is to ignore dax inodes completely.
> > Can you, please, confirm, that the following patch solves the problem?
> > 
> > Thanks!
> > 
> > --
> > 
> > diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c
> > index 06d04a74ab6c..4c3370548982 100644
> > --- a/fs/fs-writeback.c
> > +++ b/fs/fs-writeback.c
> > @@ -521,6 +521,9 @@ static bool inode_prepare_wbs_switch(struct inode *inode,
> >          */
> >         smp_mb();
> >  
> > +       if (IS_DAX(inode))
> > +               return false;
> > +
> >         /* while holding I_WB_SWITCH, no one else can update the association */
> >         spin_lock(&inode->i_lock);
> >         if (!(inode->i_sb->s_flags & SB_ACTIVE) ||
> 
> That should work, but wouldn't it be better to test that at the top of
> inode_switch_wbs()?  Or even earlier?
> 

Hm, inode_switch_wbs() is not called from the cleanup path.
The cleanup path works like this:
  cleanup_offline_cgwbs_workfn()
    cleanup_offline_cgwb()
      inode_prepare_wbs_switch()
      inode_switch_wbs_work_fn()

While the generic switching path:
  inode_switch_wbs()
    inode_prepare_wbs_switch()
    inode_switch_wbs_work_fn()

Thanks!

  reply	other threads:[~2021-07-18 16:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-15 10:10 [fsdax xfs] Regression panic at inode_switch_wbs_work_fn Murphy Zhou
2021-07-15 16:06 ` Roman Gushchin
2021-07-16  5:57   ` Murphy Zhou
2021-07-16 20:13     ` Roman Gushchin
2021-07-17 17:17       ` Darrick J. Wong
2021-07-17 17:40         ` Matthew Wilcox
2021-07-17 22:08         ` Roman Gushchin
2021-07-17 23:26           ` Matthew Wilcox
2021-07-18 16:07             ` Roman Gushchin [this message]
2021-07-19  5:56           ` Murphy Zhou
2021-07-19  5:56             ` Murphy Zhou

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=YPRRzS+WaQebrHmz@carbon.lan \
    --to=guro@fb.com \
    --cc=djwong@kernel.org \
    --cc=jencce.kernel@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=willy@infradead.org \
    /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.