From patchwork Sat Jul 2 21:24:41 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 940612 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 p62LOnWc018444 for ; Sat, 2 Jul 2011 21:24:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754718Ab1GBVYq (ORCPT ); Sat, 2 Jul 2011 17:24:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32372 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754395Ab1GBVYp (ORCPT ); Sat, 2 Jul 2011 17:24:45 -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 p62LOhJR012215 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 2 Jul 2011 17:24:43 -0400 Received: from localhost.localdomain.com (vpn-11-201.rdu.redhat.com [10.11.11.201]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p62LOgaW020258; Sat, 2 Jul 2011 17:24:43 -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 V2 Date: Sat, 2 Jul 2011 17:24:41 -0400 Message-Id: <1309641881-3393-1-git-send-email-josef@redhat.com> In-Reply-To: <1309551705-16299-1-git-send-email-josef@redhat.com> References: <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]); Sat, 02 Jul 2011 21:24:49 +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 --- V1->V2: only break if ret is actually set, I always screw this up. 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..19450bc 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 && ret != -ENOSPC) + goto error; key.offset = found_key.offset - 1; } ret = 0;