Re: [PATCH V2] workqueue: fix possible race condition when rescuer VS pwq-release

2014-04-16 Thread Lai Jiangshan
On 04/17/2014 12:50 AM, Tejun Heo wrote: > Hello, Lai. > > On Thu, Apr 17, 2014 at 12:21:21AM +0800, Lai Jiangshan wrote: >> OK. It is better to use get_pwq(). I will also change the above comments to: >> >> The base ref and the possible ref from rerscuer(stopped) are never >> dropped on per-cpu

Re: [PATCH V2] workqueue: fix possible race condition when rescuer VS pwq-release

2014-04-16 Thread Tejun Heo
Hello, Lai. On Thu, Apr 17, 2014 at 12:21:21AM +0800, Lai Jiangshan wrote: > OK. It is better to use get_pwq(). I will also change the above comments to: > > The base ref and the possible ref from rerscuer(stopped) are never > dropped on per-cpu pwqs. > Directly free the pwqs and wq. Hmmm, w

Re: [PATCH V2] workqueue: fix possible race condition when rescuer VS pwq-release

2014-04-16 Thread Lai Jiangshan
On Wed, Apr 16, 2014 at 11:23 PM, Tejun Heo wrote: > Hello, Lai. > > On Wed, Apr 16, 2014 at 09:25:16AM +0800, Lai Jiangshan wrote: >> 1) Our aim is to protect unbound pwq, not percpu pwq which can't be be >> protected by get_pwq(). >> 2) get_pwq() will make reviewers confused/surprised, destroy_

Re: [PATCH V2] workqueue: fix possible race condition when rescuer VS pwq-release

2014-04-16 Thread Tejun Heo
Hello, Lai. On Wed, Apr 16, 2014 at 09:25:16AM +0800, Lai Jiangshan wrote: > 1) Our aim is to protect unbound pwq, not percpu pwq which can't be be > protected by get_pwq(). > 2) get_pwq() will make reviewers confused/surprised, destroy_workqueue() may > destroy percpu pwqs >with ref > 1. At

Re: [PATCH V2] workqueue: fix possible race condition when rescuer VS pwq-release

2014-04-15 Thread Lai Jiangshan
On 04/16/2014 12:47 AM, Tejun Heo wrote: > On Fri, Mar 28, 2014 at 08:07:58PM +0800, Lai Jiangshan wrote: >> +static inline void get_unbound_pwq(struct pool_workqueue *pwq) >> +{ >> +if (pwq->wq->flags & WQ_UNBOUND) >> +get_pwq(pwq); >> +} >> + >> /** >> * put_pwq - put a pool_wo

Re: [PATCH V2] workqueue: fix possible race condition when rescuer VS pwq-release

2014-04-15 Thread Tejun Heo
On Fri, Mar 28, 2014 at 08:07:58PM +0800, Lai Jiangshan wrote: > +static inline void get_unbound_pwq(struct pool_workqueue *pwq) > +{ > + if (pwq->wq->flags & WQ_UNBOUND) > + get_pwq(pwq); > +} > + > /** > * put_pwq - put a pool_workqueue reference > * @pwq: pool_workqueue to p

Re: [PATCH V2] workqueue: fix possible race condition when rescuer VS pwq-release

2014-04-14 Thread Lai Jiangshan
On 04/01/2014 04:06 AM, Tejun Heo wrote: > On Mon, Mar 31, 2014 at 10:40:47PM +0800, Lai Jiangshan wrote: >> Ping > > Lai, I'll keep the mail tagged but can you pleaes ping me once -rc1 > drops? While it is an actual bug, given that it'd be pretty difficult > to trigger, I don't think it's too ur

Re: [PATCH V2] workqueue: fix possible race condition when rescuer VS pwq-release

2014-03-31 Thread Tejun Heo
On Mon, Mar 31, 2014 at 10:40:47PM +0800, Lai Jiangshan wrote: > Ping Lai, I'll keep the mail tagged but can you pleaes ping me once -rc1 drops? While it is an actual bug, given that it'd be pretty difficult to trigger, I don't think it's too urgent. Thanks! -- tejun -- To unsubscribe from thi

Re: [PATCH V2] workqueue: fix possible race condition when rescuer VS pwq-release

2014-03-31 Thread Lai Jiangshan
Ping On 03/28/2014 08:07 PM, Lai Jiangshan wrote: >>From 11af0cd0306309f0deaf3326cc26d3e7e517e3d1 Mon Sep 17 00:00:00 2001 > From: Lai Jiangshan > Date: Fri, 28 Mar 2014 00:20:12 +0800 > Subject: [PATCH] workqueue: fix possible race condition when rescuer VS > pwq-release > > There is a race co

[PATCH V2] workqueue: fix possible race condition when rescuer VS pwq-release

2014-03-28 Thread Lai Jiangshan
>From 11af0cd0306309f0deaf3326cc26d3e7e517e3d1 Mon Sep 17 00:00:00 2001 From: Lai Jiangshan Date: Fri, 28 Mar 2014 00:20:12 +0800 Subject: [PATCH] workqueue: fix possible race condition when rescuer VS pwq-release There is a race condition between rescuer_thread() and pwq_unbound_release_workfn(