diff options
author | Wang Shilong <wangsl.fnst@cn.fujitsu.com> | 2014-02-19 19:24:17 +0800 |
---|---|---|
committer | Josef Bacik <jbacik@fb.com> | 2014-03-10 15:16:53 -0400 |
commit | 12cf93728dfba237b46001a95479829c7179cdc9 (patch) | |
tree | e109418ffb99606add276a2c4a7845881098b147 /fs/btrfs/extent_map.c | |
parent | 6cf7f77e6ba55cc1469aaf795507d274402892e9 (diff) | |
download | blackbird-op-linux-12cf93728dfba237b46001a95479829c7179cdc9.tar.gz blackbird-op-linux-12cf93728dfba237b46001a95479829c7179cdc9.zip |
Btrfs: device_replace: fix deadlock for nocow case
commit cb7ab02156e4 cause a following deadlock found by
xfstests,btrfs/011:
Thread1 is commiting transaction which is blocked at
btrfs_scrub_pause().
Thread2 is calling btrfs_file_aio_write() which has held
inode's @i_mutex and commit transaction(blocked because
Thread1 is committing transaction).
Thread3 is copy_nocow_page worker which will also try to
hold inode @i_mutex, so thread3 will wait Thread1 finished.
Thread4 is waiting pending workers finished which will wait
Thread3 finished. So the problem is like this:
Thread1--->Thread4--->Thread3--->Thread2---->Thread1
Deadlock happens! we fix it by letting Thread1 go firstly,
which means we won't block transaction commit while we are
waiting pending workers finished.
Reported-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com>
Signed-off-by: Josef Bacik <jbacik@fb.com>
Diffstat (limited to 'fs/btrfs/extent_map.c')
0 files changed, 0 insertions, 0 deletions