Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp335258pxu; Thu, 3 Dec 2020 01:11:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJwR6mFTPL4Dhpcb4GQ6O7P38shAUxjo0z7j1HpPoKbZ3m1vXy3YjR4g1Q50ztvXfa8kQMNy X-Received: by 2002:a17:906:2a0a:: with SMTP id j10mr1636904eje.307.1606986692946; Thu, 03 Dec 2020 01:11:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606986692; cv=none; d=google.com; s=arc-20160816; b=y2Mlat+RML7xxnoM51jeYGPSEZRNaC6EtkbxhlStkoV/9uMc7pyHCAWzUBl0T5b2Vi yzrbC8pNRf9GUWgUnPr8PDCsudLgHqEfkjwiqhBtuQLCEtvCg03xQQFlxMuUxYi0irLM UKnYbHt3XmvoBo3MXeMGsf1fGwxET9LG5hgy+AfYuncqm8SczLJDFWJRGLvLaZPl3co8 ltiqr1mfdUA853Pq9uswki6NOqpzsI7JG2Q0YfVBwl7BlfkDJm5KLU4y6N4tZvi2UQwL ITW5+unU1wX64geGHwnZgiN2m/MsUWfW0C4TnEo9zpZjHO4bEl5hHO+SlwHNdbLYzD6J 3Jyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature; bh=x090Pi/p4YdcyRoV862Kj0ZiAvBp3vZ9F7IWYK4ZvKQ=; b=LTeB61b5voASTBS//Ow5cJ/oJfa9NtgaRSxFcTYxXUT5vtTiuTmwCo0G91QsxPCMx3 OTPNG2fd1ZBb3wWP/i2sH6n7OChJUunC1caSkzpe70qSLs56QwCscSy6AjBnOoAlcyIL 60M+kGnYx73+zhD72s+G1/IqSv/RuZ2I+to9Vxw72kSFY01YtGTParL8LTJwM+PHmLyI mIPmf98oPUAght4I/9RFbDXyxYGD0yN07MBlAizHYcSKMAxtHtLfwxTIkDvRBSvoLtC9 M88cXDyWDQxup/JXHkoKJcPOqWB7KEsJjIrp1OncJTpXjyEBvbHNyIJrqrDftkYEI+NF QWdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ckqlCtgi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oi22si824301ejb.690.2020.12.03.01.11.09; Thu, 03 Dec 2020 01:11:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ckqlCtgi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388446AbgLCJH0 (ORCPT + 99 others); Thu, 3 Dec 2020 04:07:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728037AbgLCJHZ (ORCPT ); Thu, 3 Dec 2020 04:07:25 -0500 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71B40C061A4D; Thu, 3 Dec 2020 01:06:45 -0800 (PST) Received: by mail-pj1-x1043.google.com with SMTP id j13so758889pjz.3; Thu, 03 Dec 2020 01:06:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=x090Pi/p4YdcyRoV862Kj0ZiAvBp3vZ9F7IWYK4ZvKQ=; b=ckqlCtgiG+ueA5VyNM+O63WETRQ7o586/ee4FYil95hEwBqRa6XNfo9DmTIRJhtGvU yM/nMHEzU0A54LWTZkNZnkYQajIPFM2hViIbMZnao4fBrcdOAEe0SdbnrQnsQMwak2HP wWEa70jJ+oC7e1NOAJoR/SmfkphdRmqSfLbmrSr1zOilYivX8qTIAyhvVaRKLWP9xoD1 9YWJL8QInRf55bH0dmDdQft226UAtNeuQsX+ROB7Bnz4sY66IxcroM1nlAsEA50JhEc0 bp3J/CAx5nd+UXkJsTkhURdof2tlIjC4jYzKMhMEpz8CtEYb0R6uTHvoeYVzEphjcTSF DVSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=x090Pi/p4YdcyRoV862Kj0ZiAvBp3vZ9F7IWYK4ZvKQ=; b=AwCuv7ey3bgu6fYXDmyEkeQ6n36fI4rCXwEmSDTOigCbBk7S4wxbeXlOcEzQLUugsI Pyy239ekCV1PrFcTcUAprk5TSVgoHwlY1lYFXwl6JPICDP3drD8vMI4S0c6eIgcsjmQt 4jdIKAQdtdvMC+JojcpVo7atd6UxRUPhXOK+FEwDLgHFPj0Ln6/9N3H8eBVDjkr4uIQ/ FqldR6rQgfZ+qEbYfkuMy5B6ifbhtBfbsn2fcEMXlQcttYyucEEgooF4q9CNKktXZ84h Ahu4fX3Msp5z7k6aJZrM1KpKKJAV18yig8mw0tVhyn2Vx2iOGXQwSKE9M/1mThGYZ+Rh Q44A== X-Gm-Message-State: AOAM531SaQErBYGVbifCHqsuetK6sogRLoZwWLIOR9b5mDZzYATtjgGE Fsw4q8SzXeXrpK3IuhnSgxhMHDdxSfTXkJ9jnRe8ocXdTJo= X-Received: by 2002:a17:902:bd98:b029:d9:7b0:e1e5 with SMTP id q24-20020a170902bd98b02900d907b0e1e5mr2151870pls.77.1606986404968; Thu, 03 Dec 2020 01:06:44 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a17:90a:7886:0:0:0:0 with HTTP; Thu, 3 Dec 2020 01:06:44 -0800 (PST) In-Reply-To: <79fde596-254a-510c-547a-b1525985de9d@suse.de> References: <20201130112137.587437-1-yili@winhong.com> <79fde596-254a-510c-547a-b1525985de9d@suse.de> From: Yi Li Date: Thu, 3 Dec 2020 17:06:44 +0800 Message-ID: Subject: Re: [PATCH] bcache: fix panic due to cache_set is null To: Coly Li Cc: Yi Li , kent.overstreet@gmail.com, linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org, Guo Chao Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The root cause: After just cached_dev_free do cancel_writeback_rate_update_dwork without bch_register_lock . at the same time. Wirting the writeback_percent by sysfs witch bch_register_lock will insert a writeback_rate_update work. cached_dev_free with bch_register_lock to do bcache_device_free. (it is introduce by patch 80265d8dfd77792e133793cef44a21323aac2908) pls=EF=BC=9A 1=EF=BC=9A run the shell script #!/bin/bash while [ true ] do echo 0 > /sys/block/bcache0/bcache/writeback_percent done 2: hotplug the cache disk On 12/3/20, Coly Li wrote: > On 12/3/20 2:25 PM, Yi Li wrote: >>> On 12/1/20 12:35 PM, Yi Li wrote: >>>> sorry, This patch will cause deadlock, i will check and redo it. >>> >>> Can you try latest upstream kernel firstly ? Before spending more time >>> on the fix. >>> >> >> This issue just happened three times =EF=BC=88xenserver7.5 dom0 kernel= =EF=BC=89 on the >> same machine and cannot reproduce it now. and have not reproduce it >> using the lastest uptream kernel. >> > > Hmm, this is something very probably that I am not able to help. It > seems the kernel is a third-part maintained Linux v4.4 based kernel + > bcache backport, which is out of my view. > > If similar problem happens on latest upstream kernel, or at least v5.8+ > kernel, I can help to take a look. > > >>> If I remember correctly, when cancel_writeback_rate_update_dwork() is >>> not timed out, the cache set memory won't be freed before the >>> writeback_rate_update worker terminates. It is possible that I miss >>> something in the code, but I suggest to test with a kernel after v5.3, >>> and better a v5.8+ kernel. >>> >>> Coly Li >>> >> Thanks. >> >> it is confused that why writeback_rate_update worker run again after >> cancel_delayed_work_sync( kernel log telled). >> > > [snipped] > > Coly Li >