Skip to content

Commit

Permalink
Btrfs: call the ordered free operation without any locks held
Browse files Browse the repository at this point in the history
Each ordered operation has a free callback, and this was called with the
worker spinlock held.  Josef made the free callback also call iput,
which we can't do with the spinlock.

This drops the spinlock for the free operation and grabs it again before
moving through the rest of the list.  We'll circle back around to this
and find a cleaner way that doesn't bounce the lock around so much.

Signed-off-by: Chris Mason <[email protected]>
cc: [email protected]
  • Loading branch information
Chris Mason committed Jul 25, 2012
1 parent 2b0ce2c commit e9fbcb4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion fs/btrfs/async-thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,17 @@ static noinline void run_ordered_completions(struct btrfs_workers *workers,

work->ordered_func(work);

/* now take the lock again and call the freeing code */
/* now take the lock again and drop our item from the list */
spin_lock(&workers->order_lock);
list_del(&work->order_list);
spin_unlock(&workers->order_lock);

/*
* we don't want to call the ordered free functions
* with the lock held though
*/
work->ordered_free(work);
spin_lock(&workers->order_lock);
}

spin_unlock(&workers->order_lock);
Expand Down

0 comments on commit e9fbcb4

Please sign in to comment.