Skip to content

Commit e9fbcb4

Browse files
author
Chris Mason
committed
Btrfs: call the ordered free operation without any locks held
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 <chris.mason@fusionio.com> cc: stable@kernel.org
1 parent 2b0ce2c commit e9fbcb4

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

‎fs/btrfs/async-thread.c‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,17 @@ static noinline void run_ordered_completions(struct btrfs_workers *workers,
206206

207207
work->ordered_func(work);
208208

209-
/* now take the lock again and call the freeing code */
209+
/* now take the lock again and drop our item from the list */
210210
spin_lock(&workers->order_lock);
211211
list_del(&work->order_list);
212+
spin_unlock(&workers->order_lock);
213+
214+
/*
215+
* we don't want to call the ordered free functions
216+
* with the lock held though
217+
*/
212218
work->ordered_free(work);
219+
spin_lock(&workers->order_lock);
213220
}
214221

215222
spin_unlock(&workers->order_lock);

0 commit comments

Comments
 (0)