|
@@ -497,10 +497,17 @@ static int __btrfs_end_transaction(struct btrfs_trans_handle *trans,
|
|
}
|
|
}
|
|
|
|
|
|
if (lock && cur_trans->blocked && !cur_trans->in_commit) {
|
|
if (lock && cur_trans->blocked && !cur_trans->in_commit) {
|
|
- if (throttle)
|
|
|
|
|
|
+ if (throttle) {
|
|
|
|
+ /*
|
|
|
|
+ * We may race with somebody else here so end up having
|
|
|
|
+ * to call end_transaction on ourselves again, so inc
|
|
|
|
+ * our use_count.
|
|
|
|
+ */
|
|
|
|
+ trans->use_count++;
|
|
return btrfs_commit_transaction(trans, root);
|
|
return btrfs_commit_transaction(trans, root);
|
|
- else
|
|
|
|
|
|
+ } else {
|
|
wake_up_process(info->transaction_kthread);
|
|
wake_up_process(info->transaction_kthread);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
WARN_ON(cur_trans != info->running_transaction);
|
|
WARN_ON(cur_trans != info->running_transaction);
|