Skip to content

Commit

Permalink
Btrfs: leave critical region in btrfs_find_all_roots as soon as possible
Browse files Browse the repository at this point in the history
When delayed refs exist, btrfs_find_all_roots used to hold the delayed ref
mutex way longer than actually required. We ought to drop it immediately
after we're done collecting all the delayed refs.

Signed-off-by: Jan Schmidt <list.btrfs@jan-o-sch.net>
  • Loading branch information
Jan Schmidt committed Jun 27, 2012
1 parent c3e0696 commit 155725c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions fs/btrfs/backref.c
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,7 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
}
ret = __add_delayed_refs(head, delayed_ref_seq,
&prefs_delayed);
mutex_unlock(&head->mutex);
if (ret) {
spin_unlock(&delayed_refs->lock);
goto out;
Expand Down Expand Up @@ -932,8 +933,6 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans,
}

out:
if (head)
mutex_unlock(&head->mutex);
btrfs_free_path(path);
while (!list_empty(&prefs)) {
ref = list_first_entry(&prefs, struct __prelim_ref, list);
Expand Down

0 comments on commit 155725c

Please sign in to comment.