Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Btrfs: don't walk around with task->state != TASK_RUNNING

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>

+4 -3
+1
fs/btrfs/async-thread.c
··· 377 377 if (!list_empty(&worker->pending) || 378 378 !list_empty(&worker->prio_pending)) { 379 379 spin_unlock_irq(&worker->lock); 380 + set_current_state(TASK_RUNNING); 380 381 goto again; 381 382 } 382 383
+3 -3
fs/btrfs/transaction.c
··· 1063 1063 snap_pending = 1; 1064 1064 1065 1065 WARN_ON(cur_trans != trans->transaction); 1066 - prepare_to_wait(&cur_trans->writer_wait, &wait, 1067 - TASK_UNINTERRUPTIBLE); 1068 - 1069 1066 if (cur_trans->num_writers > 1) 1070 1067 timeout = MAX_SCHEDULE_TIMEOUT; 1071 1068 else if (should_grow) ··· 1084 1087 * to the list 1085 1088 */ 1086 1089 btrfs_run_ordered_operations(root, 1); 1090 + 1091 + prepare_to_wait(&cur_trans->writer_wait, &wait, 1092 + TASK_UNINTERRUPTIBLE); 1087 1093 1088 1094 smp_mb(); 1089 1095 if (cur_trans->num_writers > 1 || should_grow)