Btrfs: hold the tree mod lock in __tree_mod_log_rewind
authorJosef Bacik <jbacik@fusionio.com>
Sun, 30 Jun 2013 03:15:19 +0000 (23:15 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 22 Jul 2013 01:21:31 +0000 (18:21 -0700)
commitc701343cd0444bd9440a4236331e80f45c75ece2
treeedb845742a6f7584157d58544c5dc9a3e383b63c
parent8049d11b3af40dc43b45017a1646ee6bd02287a1
Btrfs: hold the tree mod lock in __tree_mod_log_rewind

commit f1ca7e98a67da618d8595866e0860308525154da upstream.

We need to hold the tree mod log lock in __tree_mod_log_rewind since we walk
forward in the tree mod entries, otherwise we'll end up with random entries and
trip the BUG_ON() at the front of __tree_mod_log_rewind.  This fixes the panics
people were seeing when running

find /whatever -type f -exec btrfs fi defrag {} \;

Thansk,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/ctree.c