diff options
author | Qu Wenruo <wqu@suse.com> | 2019-02-26 03:33:56 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2019-04-29 13:02:17 -0400 |
commit | 7ac1e464c4d473b517bb784f30d40da1f842482e (patch) | |
tree | 19de63c7656fd2df9720881d78cc41ffa8591836 | |
parent | c53839fc3217085c210e1a62022016f199ae7b5a (diff) |
btrfs: Don't panic when we can't find a root key
When we failed to find a root key in btrfs_update_root(), we just panic.
That's definitely not cool, fix it by outputting an unique error
message, aborting current transaction and return -EUCLEAN. This should
not normally happen as the root has been used by the callers in some
way.
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | fs/btrfs/root-tree.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/btrfs/root-tree.c b/fs/btrfs/root-tree.c index 893d12fbfda0..1b9a5d0de139 100644 --- a/fs/btrfs/root-tree.c +++ b/fs/btrfs/root-tree.c | |||
@@ -137,11 +137,14 @@ int btrfs_update_root(struct btrfs_trans_handle *trans, struct btrfs_root | |||
137 | goto out; | 137 | goto out; |
138 | } | 138 | } |
139 | 139 | ||
140 | if (ret != 0) { | 140 | if (ret > 0) { |
141 | btrfs_print_leaf(path->nodes[0]); | 141 | btrfs_crit(fs_info, |
142 | btrfs_crit(fs_info, "unable to update root key %llu %u %llu", | 142 | "unable to find root key (%llu %u %llu) in tree %llu", |
143 | key->objectid, key->type, key->offset); | 143 | key->objectid, key->type, key->offset, |
144 | BUG_ON(1); | 144 | root->root_key.objectid); |
145 | ret = -EUCLEAN; | ||
146 | btrfs_abort_transaction(trans, ret); | ||
147 | goto out; | ||
145 | } | 148 | } |
146 | 149 | ||
147 | l = path->nodes[0]; | 150 | l = path->nodes[0]; |