From: Dave Chinner <david@fromorbit.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: Ben Myers <bpm@sgi.com>, linux-fsdevel@vger.kernel.org, xfs@oss.sgi.com
Subject: Re: [PATCH] xfs: prevent stack overflows from page cache allocation
Date: Sun, 27 Oct 2013 20:04:09 +1100 [thread overview]
Message-ID: <20131027090409.GA2797@dastard> (raw)
In-Reply-To: <20131025112934.GA1585@infradead.org>
On Fri, Oct 25, 2013 at 04:29:34AM -0700, Christoph Hellwig wrote:
> On Fri, Oct 25, 2013 at 08:24:48AM +1100, Dave Chinner wrote:
> > > > I'd much prefer aiming for the proper fix first. If for some reason we
> > > > can't get it done in time the workaround can be applied.
> > >
> > > Dave probably has a customer waiting on this.
> >
> > Obviously. And being a kernel where we have a fixed ABI, we can't
> > backport any fix that changes core code.
>
> No one is trying to tell you what to ship to your customers. That
> doesn't mean we should aim for the right fix upstream.
Have you looked at the page cache allocation code recently? e.g,
grab_cache_page_write_begin(), which we pass AOP_FLAG_NOFS into to
prevent direct reclaim deadlocks:
gfp_mask = mapping_gfp_mask(mapping);
if (mapping_cap_account_dirty(mapping))
gfp_mask |= __GFP_WRITE;
if (flags & AOP_FLAG_NOFS)
gfp_notmask = __GFP_FS;
See? The gfp mask that is used for allocation is directly based on
the gfp mask that is set on the mapping. With this patch I proposed,
we can remove the all the AOP_FLAG_NOFS usage because it's
redundant. IOWs, the mapping alread has the correct allocation
context set on it for *all* mapping based allocations without having
to add and pass magic flags to various interfaces to get it to do
the right thing.
> I don't really mind pushing patches like yours as a last resort when
> dealing with unrepsonsive or disagreeing maintainers like we had to do
> in the past, but trying to push the workaround without even attemping
> the proper fix is a bit sad.
The page cache infrastructure (i.e. the generic VFS code) is already
set up to be used in this manner, and other filesystems use it in
this way where they need to as well. So, really, I'm not sure what
problem you think needs solving here.
Indeed, I'm not even sure yet how this would be "fixed" in the VFS
code. Passing AOP_FLAG_NOFS several functions deep to get it into
ra_submit or the low level splice functions is a non-starter, so the
context needs to be carried by something else. That's exactly what
the per-mapping gfp mask does...
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2013-10-27 9:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1382585110-1796-1-git-send-email-david@fromorbit.com>
2013-10-24 8:48 ` [PATCH] xfs: prevent stack overflows from page cache allocation Christoph Hellwig
2013-10-24 10:37 ` Dave Chinner
2013-10-24 15:42 ` Christoph Hellwig
2013-10-24 16:41 ` Ben Myers
2013-10-24 21:24 ` Dave Chinner
2013-10-25 11:29 ` Christoph Hellwig
2013-10-27 9:04 ` Dave Chinner [this message]
2013-10-28 9:49 ` Christoph Hellwig
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=20131027090409.GA2797@dastard \
--to=david@fromorbit.com \
--cc=bpm@sgi.com \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=xfs@oss.sgi.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).