linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Waiman Long <longman@redhat.com>
To: Dave Chinner <david@fromorbit.com>
Cc: "Darrick J. Wong" <darrick.wong@oracle.com>,
	linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	Qian Cai <cai@lca.pw>, Eric Sandeen <sandeen@redhat.com>
Subject: Re: [PATCH v4] xfs: Fix false positive lockdep warning with sb_internal & fs_reclaim
Date: Mon, 22 Jun 2020 13:56:04 -0400	[thread overview]
Message-ID: <14d9c969-3fbe-ed1f-6821-050fc2c6289e@redhat.com> (raw)
In-Reply-To: <20200618230405.GK2005@dread.disaster.area>

On 6/18/20 7:04 PM, Dave Chinner wrote:
> On Fri, Jun 19, 2020 at 08:58:10AM +1000, Dave Chinner wrote:
>> On Thu, Jun 18, 2020 at 01:19:41PM -0400, Waiman Long wrote:
>>> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
>>> index 379cbff438bc..1b94b9bfa4d7 100644
>>> --- a/fs/xfs/xfs_super.c
>>> +++ b/fs/xfs/xfs_super.c
>>> @@ -913,11 +913,33 @@ xfs_fs_freeze(
>>>   	struct super_block	*sb)
>>>   {
>>>   	struct xfs_mount	*mp = XFS_M(sb);
>>> +	unsigned long		pflags;
>>> +	int			ret;
>>>   
>>> +	/*
>>> +	 * A fs_reclaim pseudo lock is added to check for potential deadlock
>>> +	 * condition with fs reclaim. The following lockdep splat was hit
>>> +	 * occasionally. This is actually a false positive as the allocation
>>> +	 * is being done only after the frozen filesystem is no longer dirty.
>>> +	 * One way to avoid this splat is to add GFP_NOFS to the affected
>>> +	 * allocation calls. This is what PF_MEMALLOC_NOFS is for.
>>> +	 *
>>> +	 *       CPU0                    CPU1
>>> +	 *       ----                    ----
>>> +	 *  lock(sb_internal);
>>> +	 *                               lock(fs_reclaim);
>>> +	 *                               lock(sb_internal);
>>> +	 *  lock(fs_reclaim);
>>> +	 *
>>> +	 *  *** DEADLOCK ***
>>> +	 */
>> The lockdep splat is detailed in the commit message - it most
>> definitely does not need to be repeated in full here because:
>>
>> 	a) it doesn't explain why the splat occurring is, and
>> 	b) we most definitely don't care about how the lockdep check
>> 	   that triggered it is implemented.
> I should have added this:
>
> 	c) a lot of people don't understand what lockdep reports
> 	   are telling them is a problem.
>
> I get a lot of questions like "I saw this lockdep thing, but I can't
> work out what it actually means, so can you have a look at it
> Dave?". Hence I think directly quoting something people tend not to
> understand to explain the problem they didn't understand isn't the
> best approach to improving understanding of the problem...

OK, how about simplifying the comment to as follows:

        /*
          * Disable fs reclaim in memory allocation for fs freeze to avoid
          * causing a possible circular locking dependency lockdep splat
          * involving fs reclaim.
          */

Does that look good enough for you?

Cheers,
Longman


      reply	other threads:[~2020-06-22 17:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-18 17:19 [PATCH v4] xfs: Fix false positive lockdep warning with sb_internal & fs_reclaim Waiman Long
2020-06-18 22:58 ` Dave Chinner
2020-06-18 23:04   ` Dave Chinner
2020-06-22 17:56     ` Waiman Long [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=14d9c969-3fbe-ed1f-6821-050fc2c6289e@redhat.com \
    --to=longman@redhat.com \
    --cc=cai@lca.pw \
    --cc=darrick.wong@oracle.com \
    --cc=david@fromorbit.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@redhat.com \
    /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 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).