Re: [PATCH] workqueue: Separate out drain_workqueue() fromdestroy_workqueue()

From: James Bottomley
Date: Tue Apr 05 2011 - 10:47:11 EST


On Tue, 2011-04-05 at 07:35 -0700, Tejun Heo wrote:
> There are users which want to drain workqueues without destroying it.
> Separate out drain functionality from destroy_workqueue() into
> drain_workqueue() and make it accessible to workqueue users.
>
> To guarantee forward-progress, only chain queueing is allowed while
> drain is in progress. If a new work item which isn't chained from the
> running or pending work items is queued while draining is in progress,
> WARN_ON_ONCE() is triggered.
>
> Signed-off-by: Tejun Heo <tj@xxxxxxxxxx>
> Cc: James Bottomley <James.Bottomley@xxxxxxxxxxxxxxxxxxxxx>
> ---
> James, does this seem to fit your use cases?

Perfectly, thanks. It makes sure we have eliminated all work the
workqueues generated before we return. This is needed in some of the
SCSI waits where we want all discovery to complete, not just the piece
the WQ started.

Thanks,

James


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/