diff options
author | Josef Bacik <josef@redhat.com> | 2011-01-31 16:22:42 -0500 |
---|---|---|
committer | Josef Bacik <josef@redhat.com> | 2011-03-17 14:21:26 -0400 |
commit | 66b4ffd110f9b48b8d8c1319ee446b53b8d073bf (patch) | |
tree | 690b14cda46b47c0d71be15a82019c35729afa75 /fs/btrfs/disk-io.c | |
parent | 3893e33b0bebee2f67d96b6c15259dc884523c20 (diff) |
Btrfs: handle errors in btrfs_orphan_cleanup
If we cannot truncate an inode for some reason we will never delete the orphan
item associated with that inode, which means that we will loop forever in
btrfs_orphan_cleanup. Instead of doing this just return error so we fail to
mount. It sucks, but hey it's better than hanging. Thanks,
Signed-off-by: Josef Bacik <josef@redhat.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index e1aa8d607bc7..495b1ac45f8c 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -2058,9 +2058,14 @@ struct btrfs_root *open_ctree(struct super_block *sb, | |||
2058 | 2058 | ||
2059 | if (!(sb->s_flags & MS_RDONLY)) { | 2059 | if (!(sb->s_flags & MS_RDONLY)) { |
2060 | down_read(&fs_info->cleanup_work_sem); | 2060 | down_read(&fs_info->cleanup_work_sem); |
2061 | btrfs_orphan_cleanup(fs_info->fs_root); | 2061 | err = btrfs_orphan_cleanup(fs_info->fs_root); |
2062 | btrfs_orphan_cleanup(fs_info->tree_root); | 2062 | if (!err) |
2063 | err = btrfs_orphan_cleanup(fs_info->tree_root); | ||
2063 | up_read(&fs_info->cleanup_work_sem); | 2064 | up_read(&fs_info->cleanup_work_sem); |
2065 | if (err) { | ||
2066 | close_ctree(tree_root); | ||
2067 | return ERR_PTR(err); | ||
2068 | } | ||
2064 | } | 2069 | } |
2065 | 2070 | ||
2066 | return tree_root; | 2071 | return tree_root; |
@@ -2435,8 +2440,12 @@ int btrfs_cleanup_fs_roots(struct btrfs_fs_info *fs_info) | |||
2435 | 2440 | ||
2436 | root_objectid = gang[ret - 1]->root_key.objectid + 1; | 2441 | root_objectid = gang[ret - 1]->root_key.objectid + 1; |
2437 | for (i = 0; i < ret; i++) { | 2442 | for (i = 0; i < ret; i++) { |
2443 | int err; | ||
2444 | |||
2438 | root_objectid = gang[i]->root_key.objectid; | 2445 | root_objectid = gang[i]->root_key.objectid; |
2439 | btrfs_orphan_cleanup(gang[i]); | 2446 | err = btrfs_orphan_cleanup(gang[i]); |
2447 | if (err) | ||
2448 | return err; | ||
2440 | } | 2449 | } |
2441 | root_objectid++; | 2450 | root_objectid++; |
2442 | } | 2451 | } |