Merge branch 'slab/next' of git://git.kernel.org/pub/scm/linux/kernel/git/penberg...
[cascardo/linux.git] / fs / btrfs / async-thread.c
index 4270414..58b7d14 100644 (file)
@@ -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);