]> git.baikalelectronics.ru Git - kernel.git/commit
btrfs: move btrfs_truncate_block out of trans handle
authorJosef Bacik <josef@toxicpanda.com>
Thu, 19 Oct 2017 18:16:02 +0000 (14:16 -0400)
committerDavid Sterba <dsterba@suse.com>
Wed, 1 Nov 2017 19:45:35 +0000 (20:45 +0100)
commit78013f0d89f34c388287e8e19eff3f06eb935278
treea9a43579f931d8de9d1023930a6bfd09dba0ca0f
parentae4ea1c5c0186b460ec80c6a8dadd9b1b30e2f48
btrfs: move btrfs_truncate_block out of trans handle

Since we do a delalloc reserve in btrfs_truncate_block we can deadlock
with freeze.  If somebody else is trying to allocate metadata for this
inode and it gets stuck in start_delalloc_inodes because of freeze we
will deadlock.  Be safe and move this outside of a trans handle.  This
also has a side-effect of making sure that we're not leaving stale data
behind in the other_encoding or encryption case.  Not an issue now since
nobody uses it, but it would be a problem in the future.

Signed-off-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/inode.c