[lkml]   [2012]   [Aug]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[ 050/109] Btrfs: call the ordered free operation without any locks held
From: Greg KH <>

3.4-stable review patch. If anyone has any objections, please let me know.


From: Chris Mason <>

commit e9fbcb42201c862fd6ab45c48ead4f47bb2dea9d upstream.

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 <>
Signed-off-by: Greg Kroah-Hartman <>

fs/btrfs/async-thread.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

--- a/fs/btrfs/async-thread.c
+++ b/fs/btrfs/async-thread.c
@@ -206,10 +206,17 @@ static noinline void run_ordered_complet


- /* now take the lock again and call the freeing code */
+ /* now take the lock again and drop our item from the list */
+ spin_unlock(&workers->order_lock);
+ /*
+ * we don't want to call the ordered free functions
+ * with the lock held though
+ */
+ spin_lock(&workers->order_lock);


 \ /
  Last update: 2012-08-08 02:21    [W:0.419 / U:0.020 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site