aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/scrub.c
diff options
context:
space:
mode:
authorJeff Mahoney <jeffm@suse.com>2012-03-12 11:03:00 -0400
committerDavid Sterba <dsterba@suse.cz>2012-03-22 06:52:54 -0400
commit79787eaab46121d4713ed03c8fc63b9ec3eaec76 (patch)
treeee6b17d0811ee54ab74a03aa4e0bb92769d2f12a /fs/btrfs/scrub.c
parent49b25e0540904be0bf558b84475c69d72e4de66e (diff)
btrfs: replace many BUG_ONs with proper error handling
btrfs currently handles most errors with BUG_ON. This patch is a work-in- progress but aims to handle most errors other than internal logic errors and ENOMEM more gracefully. This iteration prevents most crashes but can run into lockups with the page lock on occasion when the timing "works out." Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Diffstat (limited to 'fs/btrfs/scrub.c')
-rw-r--r--fs/btrfs/scrub.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
index 794cbb52f308..0209d8a9ae39 100644
--- a/fs/btrfs/scrub.c
+++ b/fs/btrfs/scrub.c
@@ -1505,6 +1505,9 @@ static noinline_for_stack int scrub_supers(struct scrub_dev *sdev)
1505 struct btrfs_device *device = sdev->dev; 1505 struct btrfs_device *device = sdev->dev;
1506 struct btrfs_root *root = device->dev_root; 1506 struct btrfs_root *root = device->dev_root;
1507 1507
1508 if (root->fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR)
1509 return -EIO;
1510
1508 gen = root->fs_info->last_trans_committed; 1511 gen = root->fs_info->last_trans_committed;
1509 1512
1510 for (i = 0; i < BTRFS_SUPER_MIRROR_MAX; i++) { 1513 for (i = 0; i < BTRFS_SUPER_MIRROR_MAX; i++) {