From: Dave Chinner <david@fromorbit.com>
To: Waiman Long <longman@redhat.com>
Cc: "Darrick J. Wong" <darrick.wong@oracle.com>,
Ingo Molnar <mingo@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org,
Qian Cai <cai@lca.pw>, Eric Sandeen <sandeen@redhat.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH v2 2/2] xfs: Fix false positive lockdep warning with sb_internal & fs_reclaim
Date: Thu, 18 Jun 2020 10:45:05 +1000 [thread overview]
Message-ID: <20200618004505.GG2005@dread.disaster.area> (raw)
In-Reply-To: <20200617175310.20912-3-longman@redhat.com>
On Wed, Jun 17, 2020 at 01:53:10PM -0400, Waiman Long wrote:
> fs/xfs/xfs_log.c | 9 +++++++++
> fs/xfs/xfs_trans.c | 31 +++++++++++++++++++++++++++----
> 2 files changed, 36 insertions(+), 4 deletions(-)
>
> diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
> index 00fda2e8e738..33244680d0d4 100644
> --- a/fs/xfs/xfs_log.c
> +++ b/fs/xfs/xfs_log.c
> @@ -830,8 +830,17 @@ xlog_unmount_write(
> xfs_lsn_t lsn;
> uint flags = XLOG_UNMOUNT_TRANS;
> int error;
> + unsigned long pflags;
>
> + /*
> + * xfs_log_reserve() allocates memory. This can lead to fs reclaim
> + * which may conflicts with the unmount process. To avoid that,
> + * disable fs reclaim for this allocation.
> + */
> + current_set_flags_nested(&pflags, PF_MEMALLOC_NOFS);
> error = xfs_log_reserve(mp, 600, 1, &tic, XFS_LOG, 0);
> + current_restore_flags_nested(&pflags, PF_MEMALLOC_NOFS);
> +
> if (error)
> goto out_err;
The more I look at this, the more I think Darrick is right and I
somewhat misinterpretted what he meant by "the top of the freeze
path".
i.e. setting PF_MEMALLOC_NOFS here is out of place - only one caller
of xlog_unmount_write requires PF_MEMALLOC_NOFS
context. That context should be set in the caller that requires this
context, and in this case it is xfs_fs_freeze(). This is top of the
final freeze state processing (what I think Darrick meant), not the
top of the freeze syscall call chain (what I thought he meant).
So if set PF_MEMALLOC_NOFS setting in xfs_fs_freeze(), it covers all
the allocations in this problematic path, and it should obliviates
the need for the first patch in the series altogether.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2020-06-18 0:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-17 17:53 [PATCH v2 0/2] sched, xfs: Add PF_MEMALLOC_NOLOCKDEP to fix lockdep problem in xfs Waiman Long
2020-06-17 17:53 ` [PATCH v2 1/2] sched: Add PF_MEMALLOC_NOLOCKDEP flag Waiman Long
2020-06-18 0:01 ` Dave Chinner
2020-06-18 1:32 ` Waiman Long
2020-06-22 19:16 ` Peter Zijlstra
2020-06-17 17:53 ` [PATCH v2 2/2] xfs: Fix false positive lockdep warning with sb_internal & fs_reclaim Waiman Long
2020-06-18 0:45 ` Dave Chinner [this message]
2020-06-18 1:35 ` Waiman Long
2020-06-18 1:36 ` Darrick J. Wong
2020-06-19 13:21 ` Christoph Hellwig
2020-06-19 15:08 ` 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=20200618004505.GG2005@dread.disaster.area \
--to=david@fromorbit.com \
--cc=akpm@linux-foundation.org \
--cc=cai@lca.pw \
--cc=darrick.wong@oracle.com \
--cc=juri.lelli@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=longman@redhat.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=sandeen@redhat.com \
--cc=vincent.guittot@linaro.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox