diff options
author | Chris Mason <chris.mason@oracle.com> | 2009-04-24 14:39:25 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2009-04-24 15:46:05 -0400 |
commit | 59bc5c758ece00fb0b2a170dd8fbbf31f1856c8a (patch) | |
tree | 746fcdfe8181c638b593174deb4d841310e8c698 /fs/btrfs | |
parent | e980b50cda1610f1c17978d9b7fd311a9dd93877 (diff) |
Btrfs: fix deadlocks and stalls on dead root removal
After a transaction commit, the old root of the subvol btrees are sent through
snapshot removal. This is what actually frees up any blocks replaced by
COW, and anything the old blocks pointed to.
Snapshot deletion will pause when a transaction commit has started, which
helps to avoid a huge amount of delayed reference count updates piling up
as the transaction is trying to close.
But, this pause happens after the snapshot deletion process has asked other
procs on the system to throttle back a bit so that it can make progress.
We don't want to throttle everyone while we're waiting for the transaction
commit, it leads to deadlocks in the user transaction ioctls used by Ceph
and makes things slower in general.
This patch changes things to avoid the throttling while we sleep.
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/transaction.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/btrfs/transaction.c b/fs/btrfs/transaction.c index 2869b3361eb6..01b143605ec1 100644 --- a/fs/btrfs/transaction.c +++ b/fs/btrfs/transaction.c | |||
@@ -687,7 +687,13 @@ static noinline int wait_transaction_pre_flush(struct btrfs_fs_info *info) | |||
687 | prepare_to_wait(&info->transaction_wait, &wait, | 687 | prepare_to_wait(&info->transaction_wait, &wait, |
688 | TASK_UNINTERRUPTIBLE); | 688 | TASK_UNINTERRUPTIBLE); |
689 | mutex_unlock(&info->trans_mutex); | 689 | mutex_unlock(&info->trans_mutex); |
690 | |||
691 | atomic_dec(&info->throttles); | ||
692 | wake_up(&info->transaction_throttle); | ||
693 | |||
690 | schedule(); | 694 | schedule(); |
695 | |||
696 | atomic_inc(&info->throttles); | ||
691 | mutex_lock(&info->trans_mutex); | 697 | mutex_lock(&info->trans_mutex); |
692 | finish_wait(&info->transaction_wait, &wait); | 698 | finish_wait(&info->transaction_wait, &wait); |
693 | } | 699 | } |