Btrfs: make sure to flush queued bios if write_cache_pages waits
commit01d658f2ca3c85c1ffb20b306e30d16197000ce7
authorChris Mason <chris.mason@oracle.com>
Tue, 1 Nov 2011 14:08:06 +0000 (1 10:08 -0400)
committerChris Mason <chris.mason@oracle.com>
Sun, 6 Nov 2011 08:03:48 +0000 (6 03:03 -0500)
treeeda62586bb95967a4001f8fb70e6955b531cf801
parente688b7252f784c2479d559f9f70ca8354752c5e7
Btrfs: make sure to flush queued bios if write_cache_pages waits

write_cache_pages tries to build up a large bio to stuff down the pipe.
But if it needs to wait for a page lock, it needs to make sure and send
down any pending writes so we don't deadlock with anyone who has the
page lock and is waiting for writeback of things inside the bio.

Dave Sterba triggered this as a deadlock between the autodefrag code and
the extent write_cache_pages

Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/disk-io.c
fs/btrfs/disk-io.h
fs/btrfs/extent_io.c
fs/btrfs/extent_io.h