Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1744545imm; Thu, 14 Jun 2018 03:11:57 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJbvYM+64wUOQhskml2d6gVzM+rxS/cUzzOjvb1U2PD7JPkR6d4Cy/lNtIArKT+kYzDxwmm X-Received: by 2002:a17:902:3a5:: with SMTP id d34-v6mr2322483pld.103.1528971116952; Thu, 14 Jun 2018 03:11:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528971116; cv=none; d=google.com; s=arc-20160816; b=cyaO/TL0LBT2qHPDTI67saNyCj+OBU4F6S4Jgc5di43gxcIsInWBHWkqV1ys8HBLkG J2vIHz+aS6CDi48lCEtyOhfKG/ZNAwdEs1nYMpYEnvjh046g5O4ENZNACcFSKZKYu8jP 5UUaQh+jrb+enntJg7V7tz3GRswjyn0Z7FQlBbdqov0TJgLPP3p7mmHcMngxFvyawzKH uWGtS9S+1Mwt1BqR7Gd3L0UPYpO3Kk47rysawNdW7gButdKgP/4sh1mLZ6KKIup3A3sS sKlAt5Pvhnvn+0kDCY1XQeUi6gcjgJWIgjc8foaa5PMfV/uUBSydDi56c7LIO2T5+qnK xylw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=u0sNZ1arxrlckSItyqBPYXYrNtbpAuZuG48FRnTi8tA=; b=QS/utpU21+sJhL2IpJlfxuH3kolFl/Ikog+h6sVqERYYricZr/2hr97ZqyZ5cYBKvc 4tuVcnVHYmToH1gyI2d5fhxqWjlEWx0WLIRCv0s9NgFkCqaJJ/hIb1xWu9TeLAoBIjy2 B1cShLjTS0R1Tu+Ln3R6wQGtDIzKZge0CxHzSKYdsCdfJmUmBR0aZSh9E5YtKuVnrSPZ kU8TGuUmjQuibsq4/cggH7/Vzxo8jRDBGV0/ZG0+Ku1Hutv3/MpUdZ0LqBxscHLnNxLu LK2YvLw+baPZ906wiz5JPPLCBMTDhYxoSjiQ26xAL2HPh1N6AnUA/BkEDq6Hd2P1AoXv kRLA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d18-v6si4038614pgp.214.2018.06.14.03.11.42; Thu, 14 Jun 2018 03:11:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754968AbeFNKLK (ORCPT + 99 others); Thu, 14 Jun 2018 06:11:10 -0400 Received: from mx2.suse.de ([195.135.220.15]:58843 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754737AbeFNKLI (ORCPT ); Thu, 14 Jun 2018 06:11:08 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B58FFAE5E; Thu, 14 Jun 2018 10:11:06 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 551961E1135; Thu, 14 Jun 2018 12:11:05 +0200 (CEST) Date: Thu, 14 Jun 2018 12:11:05 +0200 From: Jan Kara To: Tetsuo Handa Cc: Jan Kara , Linus Torvalds , Tejun Heo , Dmitry Vyukov , Jens Axboe , syzbot+4a7438e774b21ddd8eca@syzkaller.appspotmail.com, syzkaller-bugs@googlegroups.com, linux-fsdevel , Linux Kernel Mailing List , Al Viro , Dave Chinner , linux-block Subject: Re: [PATCH] bdi: Fix another oops in wb_workfn() Message-ID: <20180614101105.mcs7b75olai7gfxp@quack2.suse.cz> References: <20180611160131.GQ1351649@devbig577.frc2.facebook.com> <20180611162920.mwapvuqotvhkntt3@quack2.suse.cz> <20180611172053.GR1351649@devbig577.frc2.facebook.com> <20180612155754.x5k2yndh5t6wlmpy@quack2.suse.cz> <20180613144606.nvbcyg2rdjpxhf7s@quack2.suse.cz> <7f4ae045-dfe4-6677-7418-f6f60b6c26f1@i-love.sakura.ne.jp> <20180613164509.oeb3fsjylfpfzxuh@quack2.suse.cz> <4a70ca66-3352-10aa-d351-e3fa3baebffc@i-love.sakura.ne.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4a70ca66-3352-10aa-d351-e3fa3baebffc@i-love.sakura.ne.jp> User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 14-06-18 06:04:04, Tetsuo Handa wrote: > On 2018/06/14 1:45, Jan Kara wrote: > > On Wed 13-06-18 09:25:03, Linus Torvalds wrote: > >> On Wed, Jun 13, 2018 at 9:21 AM Tetsuo Handa > >> wrote: > >>> > >>> Since multiple addresses share bit_wait_table[256], isn't it possible that > >>> cgwb_start_shutdown() prematurely returns false due to wake_up_bit() by > >>> hash-conflicting addresses (i.e. not limited to clear_and_wake_up_bit() from > >>> wb_shutdown())? I think that we cannot be sure without confirming that > >>> test_bit(WB_shutting_down, &wb->state) == false after returning from schedule(). > >> > >> Right. > >> > >> That's _always_ true, btw. Something else entirely could have woken > >> you up. TASK_UNINTERRUPTIBLE does not mean "nothing else wakes me", it > >> just means "_signals_ don't wake me". > >> > >> So every single sleep always needs to be in a loop. Always. > > > > Agreed and in my patch it actually is in a loop - the one iterating the > > list of active writeback structures. If we get a false wakeup, we find the > > same structure in the list again and wait again... > > Indeed. I overlooked that wb = list_first_entry() will select same wb again > if cgwb_remove_from_bdi_list() is not yet called. Well, we could update > "(in which case we also wait for it to finish)" part or move the body of > cgwb_start_shutdown() to cgwb_bdi_unregister() so that it becomes clear > that false wake-up is not a problem in this case. I prefer to keep the wb shutdown in a separate function but I've added some comments to explain that. Honza -- Jan Kara SUSE Labs, CR