Re: [PATCH 1/1] fs-writeback: Using spin_lock to check forwork_list empty

From: KAMEZAWA Hiroyuki
Date: Thu Sep 01 2011 - 04:02:22 EST


On Wed, 31 Aug 2011 10:41:49 +0530
Rajan Aggarwal <rajan.aggarwal85@xxxxxxxxx> wrote:

> The bdi_writeback_thread function does not use spin_lock to
> see if the work_list is empty.
>
> If the list is not empty, and if an interrupt happens before we
> set the current->state to TASK_RUNNING then we could be stuck in
> a schedule() due to kernel preemption.
>
> This patch acquires and releases the wb_lock to avoid this scenario.
>
> Signed-off-by: Rajan Aggarwal <rajan.aggarwal85@xxxxxxxxx>

Hmm, even if it sleeps, bdi_wakeup_flusher() will wake up the thread.
But it seems there is an useful function schedule_timeout_interruptible().

Then, how about this ? Your concern will go away with this ?

==