Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3862317imm; Mon, 18 Jun 2018 05:28:34 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI9viYRAuc5nWhsJQsr19eA2K+UjRXTLroleoRpVdFoKmIZkmzl/GdUMEDKrxpg458uJB4M X-Received: by 2002:a62:d09:: with SMTP id v9-v6mr13172444pfi.163.1529324914091; Mon, 18 Jun 2018 05:28:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529324914; cv=none; d=google.com; s=arc-20160816; b=bT6qtvNdTEIdEY8aEbnSEhGcsLn8/J+a+GRbTPRzg2Xcd93MDiF8DoCaLPQnh5z6Zm /NUFHQdfZcfY6W69pMIxBZfPoNRyWxgcY47wtaCb1dVaA8HqaWa2QkOtYr2Lvv1RXIR4 EV0fCLhojLH9k15Dx/MxrsD8QVrU9DvRWZJrddegYycay2Sw9NgPm3R867JDSgRRF+6I mHozQK8CX7OAqOc9EYt7GOHsX6YOLJ+AdDizcWoM88XmvyBgIkpdXh2nphtpcLPo410/ R7qv9JS2TmkJgW8PJxisQkg59T0pwILa24Cmtg0gFu1zuUb0aYhIyRKGqhN5ycv/X2s6 aM6g== 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=g++XNyjTQJeJJ36nxVDmgpRGn3iJLZ/tZJtuG/2WHjQ=; b=quKnpDPiw+p7wU2jRVlRWrKk1m8Iiv4a/ByvIPboZS7PfJUYKzGmjnTdiaKVWtfJON 4tiSQWkWJdckNX81p3g/RCSV6mFm+emnCnTnU/ZbqbhEdDijYPtCOIYq9+kzR3dzXkHu 7EgWeEuLo99f2xe+qXfWPxH6m7x28A873ujlTUJnOLBe3ZWEplw5/rd2YcwYW8NcGGlh o4cOu8Rl5nupE0lFrTEh4ycCURKczxW2GRzoBn5+5h2jEg+4cyWLJbkbGxfK2rFkEt/e NkrR2kjl3MOb26IhqtKb6CU4fhjnGAZIrKikaZGmSBxDCnWeQrWtAro57t1969b4wV66 RQwg== 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 e37-v6si14448826plb.400.2018.06.18.05.28.17; Mon, 18 Jun 2018 05:28:34 -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 S1754985AbeFRM1e (ORCPT + 99 others); Mon, 18 Jun 2018 08:27:34 -0400 Received: from mx2.suse.de ([195.135.220.15]:39666 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751560AbeFRM1c (ORCPT ); Mon, 18 Jun 2018 08:27:32 -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 A6907ADD3; Mon, 18 Jun 2018 12:27:30 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id A7C251E0A81; Mon, 18 Jun 2018 14:27:29 +0200 (CEST) Date: Mon, 18 Jun 2018 14:27:29 +0200 From: Jan Kara To: Tejun Heo Cc: Jan Kara , Tetsuo Handa , Dmitry Vyukov , Jens Axboe , syzbot , syzkaller-bugs , linux-fsdevel , LKML , Al Viro , Dave Chinner , linux-block@vger.kernel.org, Linus Torvalds Subject: Re: [PATCH] bdi: Fix another oops in wb_workfn() Message-ID: <20180618122729.f5gh7nuaibuvf3e7@quack2.suse.cz> References: <2b437c6f-3e10-3d83-bdf3-82075d3eaa1a@i-love.sakura.ne.jp> <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> <20180613143315.GS1351649@devbig577.frc2.facebook.com> <20180615120620.uyc7h6sudbpsecnm@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180615120620.uyc7h6sudbpsecnm@quack2.suse.cz> 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 Fri 15-06-18 14:06:20, Jan Kara wrote: > On Wed 13-06-18 07:33:15, Tejun Heo wrote: > > Hello, Jan. > > > > On Tue, Jun 12, 2018 at 05:57:54PM +0200, Jan Kara wrote: > > > > Yeah, right, so the root cause is that we're walking the wb_list while > > > > holding lock and expecting the object to stay there even after lock is > > > > released. Hmm... we can use a mutex to synchronize the two > > > > destruction paths. It's not like they're hot paths anyway. > > > > > > Hmm, do you mean like having a per-bdi or even a global mutex that would > > > protect whole wb_shutdown()? Yes, that should work and we could get rid of > > > WB_shutting_down bit as well with that. Just it seems a bit strange to > > > > Yeap. > > > > > introduce a mutex only to synchronize these two shutdown paths - usually > > > locks protect data structures and in this case we have cgwb_lock for > > > that so it looks like a duplication from a first look. > > > > Yeah, I feel a bit reluctant too but I think that's the right thing to > > do here. This is an inherently weird case where there are two ways > > that an object can go away with the immediate drain requirement from > > one side. It's not a hot path and the dumber the synchronization the > > better, right? > > Yeah, fair enough. Something like attached patch? It is indeed considerably > simpler than fixing synchronization using WB_shutting_down. This one even > got some testing using scsi_debug, I want to do more testing next week with > more cgroup writeback included. OK, the test has passed some beating with cgroup writeback running. I'll do official posting shortly. Honza -- Jan Kara SUSE Labs, CR