Btrfs: don't panic if we get an error while balancing V2
authorJosef Bacik <josef@redhat.com>
Sat, 2 Jul 2011 21:24:41 +0000 (21:24 +0000)
committerChris Mason <chris.mason@oracle.com>
Wed, 6 Jul 2011 22:46:43 +0000 (18:46 -0400)
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 <Anand.Jain@oracle.com>
Signed-off-by: Josef Bacik <josef@redhat.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/volumes.c

index 1efa56e18f9b905ceac4dbcb3faa0221ab331ce2..19450bc536327c77f7add37e723b668da410eedd 100644 (file)
@@ -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;