]> git.hungrycats.org Git - linux/commit
btrfs: disable strict file flushes for renames and truncates
authorChris Mason <clm@fb.com>
Tue, 12 Aug 2014 17:47:42 +0000 (10:47 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 5 Sep 2014 23:36:37 +0000 (16:36 -0700)
commit5792fa6bad8a1c55be3be37d6e89081c4cf7b112
tree948e69a4eb3af78e0f05d02813b2a18912e5ca98
parent8e46c5dc5e3e7e861b1211a679b8e38ba01699a8
btrfs: disable strict file flushes for renames and truncates

commit 8d875f95da43c6a8f18f77869f2ef26e9594fecc upstream.

Truncates and renames are often used to replace old versions of a file
with new versions.  Applications often expect this to be an atomic
replacement, even if they haven't done anything to make sure the new
version is fully on disk.

Btrfs has strict flushing in place to make sure that renaming over an
old file with a new file will fully flush out the new file before
allowing the transaction commit with the rename to complete.

This ordering means the commit code needs to be able to lock file pages,
and there are a few paths in the filesystem where we will try to end a
transaction with the page lock held.  It's rare, but these things can
deadlock.

This patch removes the ordered flushes and switches to a best effort
filemap_flush like ext4 uses. It's not perfect, but it should fix the
deadlocks.

Signed-off-by: Chris Mason <clm@fb.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/btrfs_inode.h
fs/btrfs/disk-io.c
fs/btrfs/file.c
fs/btrfs/inode.c
fs/btrfs/ordered-data.c
fs/btrfs/ordered-data.h
fs/btrfs/transaction.c
fs/btrfs/transaction.h