From: Wang Sheng-Hui <shhuiw@gmail.com>
To: Chris Mason <chris.mason@oracle.com>,
linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] btrfs/extent_io.c: return -ENOMEM instead of BUG_ON on allocation failure in set_extent_bit if __GFP_WAIT is set in the mask
Date: Sat, 31 Mar 2012 15:25:17 +0800 [thread overview]
Message-ID: <4F76B15D.9010801@gmail.com> (raw)
If __GFP_WAIT is set in the mask, set_extent_bit should return
-ENOMEM to its caller to decide what to do on allocation failure,
instead of BUG_ON.
Signed-off-by: Wang Sheng-Hui <shhuiw@gmail.com>
---
fs/btrfs/extent_io.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index b67814c..fd2411e 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -720,7 +720,8 @@ int set_extent_bit(struct extent_io_tree *tree, u64 start, u64 end,
again:
if (!prealloc && (mask & __GFP_WAIT)) {
prealloc = alloc_extent_state(mask);
- BUG_ON(!prealloc);
+ if (!prealloc)
+ return -ENOMEM;
}
spin_lock(&tree->lock);
--
1.7.1
next reply other threads:[~2012-03-31 7:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-31 7:25 Wang Sheng-Hui [this message]
2012-04-04 13:29 ` [PATCH] btrfs/extent_io.c: return -ENOMEM instead of BUG_ON on allocation failure in set_extent_bit if __GFP_WAIT is set in the mask Jeff Mahoney
2012-04-05 2:10 ` Wang Sheng-Hui
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=4F76B15D.9010801@gmail.com \
--to=shhuiw@gmail.com \
--cc=chris.mason@oracle.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;
as well as URLs for NNTP newsgroup(s).