Increase extent buffer's reference count while holding the lock.
Otherwise it can race with try_release_extent_buffer.

Signed-off-by: Yan Zheng <[email protected]>

---
diff -urp 1/fs/btrfs/extent_io.c 2/fs/btrfs/extent_io.c
--- 1/fs/btrfs/extent_io.c      2010-01-17 15:48:16.770302026 +0800
+++ 2/fs/btrfs/extent_io.c      2010-02-04 16:37:45.704800682 +0800
@@ -3165,10 +3165,9 @@ struct extent_buffer *alloc_extent_buffe
                spin_unlock(&tree->buffer_lock);
                goto free_eb;
        }
-       spin_unlock(&tree->buffer_lock);
-
        /* add one reference for the tree */
        atomic_inc(&eb->refs);
+       spin_unlock(&tree->buffer_lock);
        return eb;
 
 free_eb:
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to