]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: only use the existing eb if it's count isn't 0
authorJosef Bacik <josef@redhat.com>
Fri, 9 Mar 2012 14:51:43 +0000 (09:51 -0500)
committerChris Mason <chris.mason@oracle.com>
Mon, 26 Mar 2012 20:51:08 +0000 (16:51 -0400)
commitb58e030d88e77c5227cd9f0e43494eeb2272bbf7
tree83f6bd7698b5bfddbe3be57d6411a120eced2399
parent4b92bad28b14669d44ecdfddb54ac575fa0e3c3b
Btrfs: only use the existing eb if it's count isn't 0

We can run into a problem where we find an eb for our existing page already on
the radix tree but it has a ref count of 0.  It hasn't yet been removed by RCU
yet so this can cause issues where we will use the EB after free.  So do
atomic_inc_not_zero on the exists->refs and if it is zero just do
synchronize_rcu() and try again.  We won't have to worry about new allocators
coming in since they will block on the page lock at this point.  Thanks,

Signed-off-by: Josef Bacik <josef@redhat.com>
fs/btrfs/extent_io.c