diff options
author | Josef Bacik <jbacik@fusionio.com> | 2013-08-14 15:33:56 (GMT) |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-09-01 12:05:04 (GMT) |
commit | 9ffba8cda917c0158857426f0e74b64d0206aaa9 (patch) | |
tree | 04579a95f2f494d0563d84c331be849aa4980977 /fs/btrfs/ctree.h | |
parent | 4ef31a45a009a81b2f3c5aaf6f07d7147f80bc8c (diff) | |
download | linux-fsl-qoriq-9ffba8cda917c0158857426f0e74b64d0206aaa9.tar.xz |
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>
Diffstat (limited to 'fs/btrfs/ctree.h')
-rw-r--r-- | fs/btrfs/ctree.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.h b/fs/btrfs/ctree.h index 0632832..063e485 100644 --- a/fs/btrfs/ctree.h +++ b/fs/btrfs/ctree.h @@ -1413,6 +1413,13 @@ struct btrfs_fs_info { * before jumping into the main commit. */ struct mutex ordered_operations_mutex; + + /* + * Same as ordered_operations_mutex except this is for ordered extents + * and not the operations. + */ + struct mutex ordered_extent_flush_mutex; + struct rw_semaphore extent_commit_sem; struct rw_semaphore cleanup_work_sem; |