linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Is this a race bug when releasing eb?
@ 2014-04-07 15:45 ylet ylet
  2014-04-07 15:50 ` Josef Bacik
  0 siblings, 1 reply; 6+ messages in thread
From: ylet ylet @ 2014-04-07 15:45 UTC (permalink / raw)
  To: linux-btrfs; +Cc: clm, jbacik

Assuming thread 1 (may be VFS want to release the page) wants to
release a CLEAN page and thus the eb attaching the page.
and thread 2 wants to access the eb and cow the eb.

Thread 1
               Thread 2

btree_releasepage

try_release_extent_buffer

release_extent_buffer
->if (atomic_dec_and_test(&eb->refs)) {
->spin_unlock(&eb->refs_lock);
 -------switch to thread 2 here------

               read_block_for_search

                btrfs_find_tree_block

     radix_tree_lookup && atomic_inc_not_zero

                  ................

                btrfs_mark_buffer_dirty(eb)

                ---------switch to thread 1 here ------

- >spin_lock(&tree->buffer_lock);
->radix_tree_delete(&tree->buffer,
 eb->start >> PAGE_CACHE_SHIFT);
->spin_unlock(&tree->buffer_lock);
-->btrfs_release_extent_buffer_page
-->trigger BUG_ON(extent_buffer_under_io(eb))!!!!


This is because Thread 2 can still find the eb while thread 1 has dec
the eb->refs to 0, so eventually trigger the BUG_ON.

I have triggered the BUG_ON while testing btrfs, but I am not sure if
the bug-on is rise by my guess above.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-04-07 16:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-07 15:45 Is this a race bug when releasing eb? ylet ylet
2014-04-07 15:50 ` Josef Bacik
     [not found]   ` <CAAcaxmWEDa+jS8n4LZKdE_ZXFVAoOgACDseQs0_fViYdfRHShg@mail.gmail.com>
2014-04-07 16:01     ` Fwd: " ylet ylet
2014-04-07 16:03       ` Josef Bacik
2014-04-07 16:12       ` ylet ylet
2014-04-07 16:16         ` Josef Bacik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).