aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fusionio.com>2013-09-27 16:32:39 -0400
committerChris Mason <chris.mason@fusionio.com>2013-11-11 21:53:42 -0500
commit4e121c06adf53aae478ebce3035116595d063413 (patch)
treedebfa36ad00bef15ca1d052e98a315eda665c2ee /fs
parentb6d08f0630d51ec09d67f16f6d7839699bbc0402 (diff)
Btrfs: cleanup transaction on abort
If we abort not during a transaction commit we won't clean up anything until we unmount. Unfortunately if we abort in the middle of writing out an ordered extent we won't clean it up and if somebody is waiting on that ordered extent they will wait forever. To fix this just make the transaction kthread call the cleanup transaction stuff if it notices theres an error, and make btrfs_end_transaction wake up the transaction kthread if there is an error. Thanks, Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/btrfs/disk-io.c3
-rw-r--r--fs/btrfs/transaction.c4
2 files changed, 6 insertions, 1 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
index db2095486a4f..113cd43530ba 100644
--- a/fs/btrfs/disk-io.c
+++ b/fs/btrfs/disk-io.c
@@ -1800,6 +1800,9 @@ sleep:
1800 wake_up_process(root->fs_info->cleaner_kthread); 1800 wake_up_process(root->fs_info->cleaner_kthread);
1801 mutex_unlock(&root->fs_info->transaction_kthread_mutex); 1801 mutex_unlock(&root->fs_info->transaction_kthread_mutex);
1802 1802
1803 if (unlikely(test_bit(BTRFS_FS_STATE_ERROR,
1804 &root->fs_info->fs_state)))
1805 btrfs_cleanup_transaction(root);
1803 if (!try_to_freeze()) { 1806 if (!try_to_freeze()) {
1804 set_current_state(TASK_INTERRUPTIBLE); 1807 set_current_state(TASK_INTERRUPTIBLE);
1805 if (!kthread_should_stop() && 1808 if (!kthread_should_stop() &&
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c
index 7138d6a3726e..a1343e81c59d 100644
--- a/fs/btrfs/transaction.c
+++ b/fs/btrfs/transaction.c
@@ -744,8 +744,10 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
744 btrfs_run_delayed_iputs(root); 744 btrfs_run_delayed_iputs(root);
745 745
746 if (trans->aborted || 746 if (trans->aborted ||
747 test_bit(BTRFS_FS_STATE_ERROR, &root->fs_info->fs_state)) 747 test_bit(BTRFS_FS_STATE_ERROR, &root->fs_info->fs_state)) {
748 wake_up_process(info->transaction_kthread);
748 err = -EIO; 749 err = -EIO;
750 }
749 assert_qgroups_uptodate(trans); 751 assert_qgroups_uptodate(trans);
750 752
751 kmem_cache_free(btrfs_trans_handle_cachep, trans); 753 kmem_cache_free(btrfs_trans_handle_cachep, trans);