On Thu, Mar 06, 2014 at 07:01:07PM -0500, Josef Bacik wrote: > Zach found this deadlock that would happen like this > > btrfs_end_transaction <- reduce trans->use_count to 0 > btrfs_run_delayed_refs > btrfs_cow_block > find_free_extent > btrfs_start_transaction <- increase trans->use_count to 1 > allocate chunk > btrfs_end_transaction <- decrease trans->use_count to 0 > btrfs_run_delayed_refs > lock tree block we are cowing above ^^
Indeed, I stumbled across this while trying to reproduce reported problems with iozone. This deadlock would consistently hit during random 1k reads in a 2gig file. > We need to only decrease trans->use_count if it is above 1, otherwise leave it > alone. This will make nested trans be the only ones who decrease their added > ref, and will let us get rid of the trans->use_count++ hack if we have to > commit > the transaction. Thanks, And this fixes it. It's run through a few times successfully. > cc: sta...@vger.kernel.org > Reported-by: Zach Brown <z...@redhat.com> > Signed-off-by: Josef Bacik <jba...@fb.com> Tested-by: Zach Brown <z...@redhat.com> - z -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html