From: Liu Bo <bo.li.liu@oracle.com>
To: linux-btrfs@vger.kernel.org
Subject: [PATCH] Btrfs: fix crash of starting balance
Date: Tue, 15 Jan 2013 22:47:57 +0800 [thread overview]
Message-ID: <1358261277-3566-1-git-send-email-bo.li.liu@oracle.com> (raw)
We will crash on BUG_ON(ret == -EEXIST) when we do not resume the existing
balance but attempt to start a new one.
The steps can be:
1. start balance
2. pause balance
3. start balance
Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
---
fs/btrfs/volumes.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
index 5cce6aa..3901654 100644
--- a/fs/btrfs/volumes.c
+++ b/fs/btrfs/volumes.c
@@ -3100,7 +3100,12 @@ int btrfs_balance(struct btrfs_balance_control *bctl,
goto out;
if (!(bctl->flags & BTRFS_BALANCE_RESUME)) {
- BUG_ON(ret == -EEXIST);
+ /*
+ * This can happen when we do not resume the existing balance
+ * but try to start a new one instead.
+ */
+ if (ret == -EEXIST)
+ goto out;
set_balance_control(bctl);
} else {
BUG_ON(ret != -EEXIST);
--
1.7.7.6
next reply other threads:[~2013-01-15 14:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-15 14:47 Liu Bo [this message]
2013-01-15 16:59 ` [PATCH] Btrfs: fix crash of starting balance Ilya Dryomov
2013-01-16 1:05 ` Liu Bo
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=1358261277-3566-1-git-send-email-bo.li.liu@oracle.com \
--to=bo.li.liu@oracle.com \
--cc=linux-btrfs@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).