Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp1138477imm; Wed, 13 Jun 2018 14:05:43 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJV25x7ATavc5BtBoHF58K6o9k76tnyET1olpJBFld7tJjEZ63DMyFBcjFpL6+9Ol447Vpv X-Received: by 2002:a63:6ec8:: with SMTP id j191-v6mr5467187pgc.232.1528923943416; Wed, 13 Jun 2018 14:05:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528923943; cv=none; d=google.com; s=arc-20160816; b=s4SGE2AQWbufpOMJn4LngRavOSaC8+f5JNuRFc/SEJ2rTYkNnMeD+lVZqoGWOxBZFI CO8PCq95AoYui57y/cbjKNYm5WGanGqGxuwUI4u4N901w3MPHBZOYb2hMUosIxP602rN xvHhJfhLvb8obDldL2VSo0jEhuwXX33jlmG22reliaYMM+/OusQAGW9XIcUocPOFW0km bhNYbR1khq/oNgCgXitnBT6a77ijFyZS1+PK+ig1WecwOsOVXaCCk1tAq7rS0YAU86MW hHebUxuxhX5sA2PHKRCxKqnCNtMWc+YcM0LDQUdxikw5wRubUXrmUdks2sUX7fWhZQpr sJmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=03EB+ESdzOfLpS+9Qeu6ac1FEwCll23tdzMzx7HTHrY=; b=Js3Fv8w/3cDuW85rHzbTo5A0ohogJdxqA5RZk7iu1TMRYwt2lKi/BeHeom1ZGhNk5W feJtfX5MLv2vzE7LH6Yx33VLyntODmTLJaW81xqphjISgyo2t29L+8tHdOOzF2WldxKf RnHiNs+sQc4biLW5uTHbv4KQfgVcF8ovKCEYpn2Ta+v93X9x/J0TFTmLTflxCuDFXWQV R+ZR2gwprYRWx2qdXZh3FbUoxu90JPp2bmScIW2PGl+TlFmAXbjUcJRXmr2JjduGsfUA uU3Hd0pz1mHipwNFFOMFlCYsrF7MhUF0qwq3g7j1F4+HTajfeEJ57/Dp8fqp8PqAcrRf 4GDQ== 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 i62-v6si3743520pfc.255.2018.06.13.14.05.28; Wed, 13 Jun 2018 14:05:43 -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 S935729AbeFMVFF (ORCPT + 99 others); Wed, 13 Jun 2018 17:05:05 -0400 Received: from www262.sakura.ne.jp ([202.181.97.72]:19952 "EHLO www262.sakura.ne.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935526AbeFMVFD (ORCPT ); Wed, 13 Jun 2018 17:05:03 -0400 Received: from fsav401.sakura.ne.jp (fsav401.sakura.ne.jp [133.242.250.100]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id w5DL4DvL009430; Thu, 14 Jun 2018 06:04:13 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav401.sakura.ne.jp (F-Secure/fsigk_smtp/530/fsav401.sakura.ne.jp); Thu, 14 Jun 2018 06:04:13 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/530/fsav401.sakura.ne.jp) Received: from [192.168.1.8] (softbank126074194044.bbtec.net [126.74.194.44]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id w5DL47VD009397 (version=TLSv1.2 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 14 Jun 2018 06:04:12 +0900 (JST) (envelope-from penguin-kernel@i-love.sakura.ne.jp) Subject: Re: [PATCH] bdi: Fix another oops in wb_workfn() To: Jan Kara , Linus Torvalds Cc: 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 References: <3cf4b0e3-31b6-8cdc-7c1e-15ba575a7879@i-love.sakura.ne.jp> <20180611091248.2i6nt27h5mxrodm2@quack2.suse.cz> <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> From: Tetsuo Handa Message-ID: <4a70ca66-3352-10aa-d351-e3fa3baebffc@i-love.sakura.ne.jp> Date: Thu, 14 Jun 2018 06:04:04 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180613164509.oeb3fsjylfpfzxuh@quack2.suse.cz> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.