From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752365Ab1IKDav (ORCPT ); Sat, 10 Sep 2011 23:30:51 -0400 Received: from mail-pz0-f42.google.com ([209.85.210.42]:49601 "EHLO mail-pz0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751857Ab1IKDau (ORCPT ); Sat, 10 Sep 2011 23:30:50 -0400 Date: Sun, 11 Sep 2011 12:30:42 +0900 From: Tejun Heo To: Thomas Tuttle Cc: lkml Subject: Re: [PATCH v3] workqueue: lock cwq access in drain_workqueue Message-ID: <20110911033042.GN29319@htj.dyndns.org> References: <20110909152222.GA14705@google.com> <20110909230053.GA28394@google.com> <20110911013549.GI29319@htj.dyndns.org> <20110911032641.GA22325@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110911032641.GA22325@google.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Sat, Sep 10, 2011 at 11:26:41PM -0400, Thomas Tuttle wrote: > Take cwq->gcwq->lock to avoid racing between drain_workqueue checking > to make sure the workqueues are empty and cwq_dec_nr_in_flight > decrementing and then incrementing nr_active when it activates a > delayed work. > > We discovered this when a corner case in one of our drivers resulted in > us trying to destroy a workqueue in which the remaining work would > always requeue itself again in the same workqueue. We would hit this > race condition and trip the BUG_ON on workqueue.c:3080. > > Signed-off-by: Thomas Tuttle Acked-by: Tejun Heo Can you please also add "Cc: stable@kernel.org" and send it to Andrew Morton ? Thank you very much. -- tejun