From patchwork Fri Jul 1 20:21:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 937382 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p61KMDqJ026446 for ; Fri, 1 Jul 2011 20:22:13 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755237Ab1GAUV4 (ORCPT ); Fri, 1 Jul 2011 16:21:56 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14833 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755126Ab1GAUVz (ORCPT ); Fri, 1 Jul 2011 16:21:55 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p61KLrDH024808 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 1 Jul 2011 16:21:53 -0400 Received: from localhost.localdomain.com (vpn-11-148.rdu.redhat.com [10.11.11.148]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p61KLpMS021538; Fri, 1 Jul 2011 16:21:52 -0400 From: Josef Bacik To: linux-btrfs@vger.kernel.org Cc: Anand.Jain@oracle.com Subject: [PATCH] Btrfs: don't panic if we get an error while balancing Date: Fri, 1 Jul 2011 16:21:45 -0400 Message-Id: <1309551705-16299-1-git-send-email-josef@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 01 Jul 2011 20:22:13 +0000 (UTC) A user reported an error where if we try to balance an fs after a device has been removed it will blow up. This is because we get an EIO back and this is where BUG_ON(ret) bites us in the ass. To fix we just exit. Thanks, Reported-by: Anand Jain Signed-off-by: Josef Bacik --- fs/btrfs/volumes.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 1efa56e..685bc0f 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c @@ -2098,7 +2098,8 @@ int btrfs_balance(struct btrfs_root *dev_root) chunk_root->root_key.objectid, found_key.objectid, found_key.offset); - BUG_ON(ret && ret != -ENOSPC); + if (ret != -ENOSPC) + goto error; key.offset = found_key.offset - 1; } ret = 0;