]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
Btrfs: don't walk around with task->state != TASK_RUNNING
authorChris Mason <chris.mason@oracle.com>
Tue, 25 May 2010 14:12:41 +0000 (10:12 -0400)
committerChris Mason <chris.mason@oracle.com>
Tue, 25 May 2010 14:34:58 +0000 (10:34 -0400)
Yan Zheng noticed two places we were doing a lot of work
without task->state set to TASK_RUNNING.  This sets the state
properly after we get ready to sleep but decide not to.

Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/async-thread.c
fs/btrfs/transaction.c

index 462859a30141faa7c6ee645ad750cf0ae48c9692..7ec14097fef1f3bbb9b7611a96111c55d0ba9e19 100644 (file)
@@ -377,6 +377,7 @@ again:
                                if (!list_empty(&worker->pending) ||
                                    !list_empty(&worker->prio_pending)) {
                                        spin_unlock_irq(&worker->lock);
+                                       set_current_state(TASK_RUNNING);
                                        goto again;
                                }
 
index c346d320173aeec244a94c439d357f1c8daa6123..66e4c66cc63bf114900c6da4462c32e6bd0e65e0 100644 (file)
@@ -1063,9 +1063,6 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
                        snap_pending = 1;
 
                WARN_ON(cur_trans != trans->transaction);
-               prepare_to_wait(&cur_trans->writer_wait, &wait,
-                               TASK_UNINTERRUPTIBLE);
-
                if (cur_trans->num_writers > 1)
                        timeout = MAX_SCHEDULE_TIMEOUT;
                else if (should_grow)
@@ -1088,6 +1085,9 @@ int btrfs_commit_transaction(struct btrfs_trans_handle *trans,
                 */
                btrfs_run_ordered_operations(root, 1);
 
+               prepare_to_wait(&cur_trans->writer_wait, &wait,
+                               TASK_UNINTERRUPTIBLE);
+
                smp_mb();
                if (cur_trans->num_writers > 1 || should_grow)
                        schedule_timeout(timeout);