From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f70.google.com (mail-pg0-f70.google.com [74.125.83.70]) by kanga.kvack.org (Postfix) with ESMTP id 2DD6B6B0003 for ; Tue, 1 May 2018 17:31:05 -0400 (EDT) Received: by mail-pg0-f70.google.com with SMTP id 127-v6so8802495pge.10 for ; Tue, 01 May 2018 14:31:05 -0700 (PDT) Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id f19-v6sor3742504plj.13.2018.05.01.14.31.03 for (Google Transport Security); Tue, 01 May 2018 14:31:03 -0700 (PDT) Subject: Re: INFO: task hung in wb_shutdown (2) References: <94eb2c05b2d83650030568cc8bd9@google.com> <43302799-1c50-4cab-b974-9fe1ca584813@I-love.SAKURA.ne.jp> From: Jens Axboe Message-ID: Date: Tue, 1 May 2018 15:30:59 -0600 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org List-ID: To: Linus Torvalds , Tetsuo Handa Cc: Jan Kara , Tejun Heo , syzbot+c0cf869505e03bdf1a24@syzkaller.appspotmail.com, christophe.jaillet@wanadoo.fr, Linux Kernel Mailing List , linux-mm , syzkaller-bugs@googlegroups.com, zhangweiping@didichuxing.com, Andrew Morton , Dmitry Vyukov , linux-block On 5/1/18 10:06 AM, Linus Torvalds wrote: > On Tue, May 1, 2018 at 3:27 AM Tetsuo Handa < > penguin-kernel@i-love.sakura.ne.jp> wrote: > >> Can you review this patch? syzbot has hit this bug for nearly 4000 times > but >> is still unable to find a reproducer. Therefore, the only way to test > would be >> to apply this patch upstream and test whether the problem is solved. > > Looks ok to me, except: > >>> smp_wmb(); >>> clear_bit(WB_shutting_down, &wb->state); >>> + smp_mb(); /* advised by wake_up_bit() */ >>> + wake_up_bit(&wb->state, WB_shutting_down); > > This whole sequence really should just be a pattern with a helper function. > > And honestly, the pattern probably *should* be > > clear_bit_unlock(bit, &mem); > smp_mb__after_atomic() > wake_up_bit(&mem, bit); > > which looks like it is a bit cleaner wrt memory ordering rules. Agree, that construct looks saner than introducing a "random" smp_mb(). As a pattern helper, should probably be introduced after the fact. -- Jens Axboe