Skip to content

Commit

Permalink
Thaw refrigerated bdi flusher threads before invoking kthread_stop on…
Browse files Browse the repository at this point in the history
… them

Unfreezes the bdi flusher task when the said task needs to exit.

Steps to reproduce this.
1) Mount a file system from MMC/SD card.
2) Unmount the file system. This creates a flusher task.
3) Attempt suspend to RAM. System is unresponsive.

This is because the bdi flusher thread is already in the refrigerator and will
remain so until it is thawed. The MMC driver suspend routine call stack will
ultimately issue a 'kthread_stop' on the bdi flusher thread and will block
until the flusher thread is exited. Since the bdi flusher thread is in the
refrigerator it never cleans up until thawed.

Signed-off-by: Romit Dasgupta <romit@ti.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
  • Loading branch information
Romit Dasgupta authored and Jens Axboe committed Nov 12, 2009
1 parent aa021ba commit c62b17a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mm/backing-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,10 +604,14 @@ static void bdi_wb_shutdown(struct backing_dev_info *bdi)

/*
* Finally, kill the kernel threads. We don't need to be RCU
* safe anymore, since the bdi is gone from visibility.
* safe anymore, since the bdi is gone from visibility. Force
* unfreeze of the thread before calling kthread_stop(), otherwise
* it would never exet if it is currently stuck in the refrigerator.
*/
list_for_each_entry(wb, &bdi->wb_list, list)
list_for_each_entry(wb, &bdi->wb_list, list) {
wb->task->flags &= ~PF_FROZEN;
kthread_stop(wb->task);
}
}

/*
Expand Down

0 comments on commit c62b17a

Please sign in to comment.