]> git.baikalelectronics.ru Git - kernel.git/commit
Btrfs: fix heavy delalloc related deadlock
authorJosef Bacik <jbacik@fusionio.com>
Wed, 14 Aug 2013 15:33:56 +0000 (11:33 -0400)
committerChris Mason <chris.mason@fusionio.com>
Sun, 1 Sep 2013 12:05:04 +0000 (08:05 -0400)
commitc4d1c07d9bb5bfb52982e949b1d742a696abd9c9
tree04579a95f2f494d0563d84c331be849aa4980977
parent57471689e55e55fbb7864c8c1f598a64d42804e7
Btrfs: fix heavy delalloc related deadlock

I added a patch where we started taking the ordered operations mutex when we
waited on ordered extents.  We need this because we splice the list and process
it, so if a flusher came in during this scenario it would think the list was
empty and we'd usually get an early ENOSPC.  The problem with this is that this
lock is used in transaction committing.  So we end up with something like this

Transaction commit
-> wait on writers

Delalloc flusher
-> run_ordered_operations (holds mutex)
->wait for filemap-flush to do its thing

flush task
-> cow_file_range
->wait on btrfs_join_transaction because we're commiting

some other task
-> commit_transaction because we notice trans->transaction->flush is set
-> run_ordered_operations (hang on mutex)

We need to disentangle the ordered operations flushing from the delalloc
flushing, since they are separate things.  This solves the deadlock issue I was
seeing.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
fs/btrfs/ctree.h
fs/btrfs/disk-io.c
fs/btrfs/ordered-data.c