diff options
Diffstat (limited to 'fs/btrfs/backref.c')
-rw-r--r-- | fs/btrfs/backref.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 7301cdb4b2cb..a383c18e74e8 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c | |||
@@ -301,10 +301,14 @@ static int __resolve_indirect_ref(struct btrfs_fs_info *fs_info, | |||
301 | goto out; | 301 | goto out; |
302 | 302 | ||
303 | eb = path->nodes[level]; | 303 | eb = path->nodes[level]; |
304 | if (!eb) { | 304 | while (!eb) { |
305 | WARN_ON(1); | 305 | if (!level) { |
306 | ret = 1; | 306 | WARN_ON(1); |
307 | goto out; | 307 | ret = 1; |
308 | goto out; | ||
309 | } | ||
310 | level--; | ||
311 | eb = path->nodes[level]; | ||
308 | } | 312 | } |
309 | 313 | ||
310 | ret = add_all_parents(root, path, parents, level, &ref->key_for_search, | 314 | ret = add_all_parents(root, path, parents, level, &ref->key_for_search, |
@@ -835,6 +839,7 @@ again: | |||
835 | } | 839 | } |
836 | ret = __add_delayed_refs(head, delayed_ref_seq, | 840 | ret = __add_delayed_refs(head, delayed_ref_seq, |
837 | &prefs_delayed); | 841 | &prefs_delayed); |
842 | mutex_unlock(&head->mutex); | ||
838 | if (ret) { | 843 | if (ret) { |
839 | spin_unlock(&delayed_refs->lock); | 844 | spin_unlock(&delayed_refs->lock); |
840 | goto out; | 845 | goto out; |
@@ -928,8 +933,6 @@ again: | |||
928 | } | 933 | } |
929 | 934 | ||
930 | out: | 935 | out: |
931 | if (head) | ||
932 | mutex_unlock(&head->mutex); | ||
933 | btrfs_free_path(path); | 936 | btrfs_free_path(path); |
934 | while (!list_empty(&prefs)) { | 937 | while (!list_empty(&prefs)) { |
935 | ref = list_first_entry(&prefs, struct __prelim_ref, list); | 938 | ref = list_first_entry(&prefs, struct __prelim_ref, list); |