public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Omar Sandoval <osandov@osandov.com>
To: Chris Mason <clm@fb.com>, Josef Bacik <jbacik@fb.com>,
	David Sterba <dsterba@suse.cz>
Cc: linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org,
	Omar Sandoval <osandov@osandov.com>
Subject: [PATCH v2 0/3] btrfs: ENOMEM bugfixes
Date: Tue, 24 Feb 2015 02:47:03 -0800	[thread overview]
Message-ID: <cover.1424773781.git.osandov@osandov.com> (raw)

Hi, everyone,

This patch series fixes a few bugs that occur under low memory conditions.
These were exposed by a change in behavior of GFP_NOFS allocations in 3.19-rc7,
by commit 9879de7373fc ("mm: page_alloc: embed OOM killing naturally into
allocation slowpath"). While the mm people sort that out, we can fix these
issues, which are bugs no matter what the outcome there is.

Here's a quick script which reproduces these bugs. With the patches applied, the
filesystem will drop into read-only mode instead of blowing up.

----
#!/bin/sh

cgcreate -g memory:enomem
MEM=$((64 * 1024 * 1024))
echo $MEM > /sys/fs/cgroup/memory/enomem/memory.limit_in_bytes

cgexec -g memory:enomem ~/xfstests/ltp/fsstress -p128 -n999999999 -d /mnt/test &
trap "killall fsstress; exit 0" SIGINT SIGTERM

while true; do
	cgexec -g memory:enomem python -c '
l = []
while True:
    l.append(0)'
done
----

Version 2 rebases on top of 4.0-rc1, has a simpler fix for the
alloc_extent_buffer race, expands the commit messages to mention changed
comments, and adds Liu Bo's Reviewed-by.

Thanks!

Omar Sandoval (3):
  btrfs: handle ENOMEM in btrfs_alloc_tree_block
  btrfs: fix race on ENOMEM in alloc_extent_buffer
  btrfs: check io_ctl_prepare_pages return in __btrfs_write_out_cache

 fs/btrfs/extent-tree.c      | 41 ++++++++++++++++++++++++++++-------------
 fs/btrfs/extent_io.c        |  3 ++-
 fs/btrfs/free-space-cache.c | 10 ++++++----
 3 files changed, 36 insertions(+), 18 deletions(-)
-- 
2.3.0


             reply	other threads:[~2015-02-24 10:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-24 10:47 Omar Sandoval [this message]
2015-02-24 10:47 ` [PATCH v2 1/3] btrfs: handle ENOMEM in btrfs_alloc_tree_block Omar Sandoval
2015-03-13 13:34   ` David Sterba
2015-02-24 10:47 ` [PATCH v2 2/3] btrfs: fix race on ENOMEM in alloc_extent_buffer Omar Sandoval
2015-03-13 13:31   ` David Sterba
2015-03-18 14:21   ` Liu Bo
2015-02-24 10:47 ` [PATCH v2 3/3] btrfs: check io_ctl_prepare_pages return in __btrfs_write_out_cache Omar Sandoval
2015-03-12  4:40 ` [PATCH v2 0/3] btrfs: ENOMEM bugfixes Omar Sandoval
2015-03-13 11:04   ` David Sterba
2015-03-13 19:43     ` Omar Sandoval
2015-03-27 21:06       ` Omar Sandoval
2015-04-13 21:32         ` Omar Sandoval

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=cover.1424773781.git.osandov@osandov.com \
    --to=osandov@osandov.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.cz \
    --cc=jbacik@fb.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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