public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Waiman Long <longman@redhat.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 v5] xfs: Fix false positive lockdep warning with sb_internal & fs_reclaim
Date: Fri, 3 Jul 2020 11:07:20 +1000	[thread overview]
Message-ID: <20200703010720.GH5369@dread.disaster.area> (raw)
In-Reply-To: <20200702005923.10064-1-longman@redhat.com>

On Wed, Jul 01, 2020 at 08:59:23PM -0400, Waiman Long wrote:
> Suggested-by: Dave Chinner <david@fromorbit.com>
> Signed-off-by: Waiman Long <longman@redhat.com>
> ---
>  fs/xfs/xfs_super.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c
> index 379cbff438bc..dcc97bad950a 100644
> --- a/fs/xfs/xfs_super.c
> +++ b/fs/xfs/xfs_super.c
> @@ -913,11 +913,21 @@ xfs_fs_freeze(
>  	struct super_block	*sb)
>  {
>  	struct xfs_mount	*mp = XFS_M(sb);
> +	unsigned long		pflags;
> +	int			ret;
>  
> +	/*
> +	 * Disable fs reclaim in memory allocation for fs freeze to avoid
> +	 * causing a possible circular locking dependency lockdep splat
> +	 * relating to fs reclaim.
> +	 */

	/*
	 * The filesystem is now frozen far enough that memory reclaim
	 * cannot safely operate on the filesystem. Hence we need to
	 * set a GFP_NOFS context here to avoid recursion deadlocks.
	 */

> +	current_set_flags_nested(&pflags, PF_MEMALLOC_NOFS);

memalloc_nofs_save/restore(), please.

-Dave.
-- 
Dave Chinner
david@fromorbit.com

  reply	other threads:[~2020-07-03  1:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-02  0:59 [PATCH v5] xfs: Fix false positive lockdep warning with sb_internal & fs_reclaim Waiman Long
2020-07-03  1:07 ` Dave Chinner [this message]
2020-07-03  3:05   ` Waiman Long

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=20200703010720.GH5369@dread.disaster.area \
    --to=david@fromorbit.com \
    --cc=cai@lca.pw \
    --cc=darrick.wong@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=longman@redhat.com \
    --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