Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5580026ybi; Tue, 4 Jun 2019 08:44:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqwjSXLV6m00jlvtGh9or5nTMk3cplL2UvBNEa70qXK8KzDUzoqft5TiPQ0f7bTaV1hQXCbw X-Received: by 2002:a65:41c6:: with SMTP id b6mr35525409pgq.399.1559663098186; Tue, 04 Jun 2019 08:44:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559663098; cv=none; d=google.com; s=arc-20160816; b=o2xY8iDbahGb/VSPp9eGluhLwqiDQwBnSdvClrNUzAa+gfAkLfUw50jdNKyCkk7qpU cRT7/qUSgdafr0NjG6nWaeeivrvl2ceIjk7XuBhqQaWNbcat2gABugNWIo1Y4iR5VVS7 RwQn4rem82iH/EiIcFAe+FWnN2uFEK1VvO1Q1bdnDCHh+p+ZCCyq+dBMyXFTR7eP3n76 vXBsAawCM0MRfwKlN/71rwS0BNrqyzKOqBfSuomfm9D2oBACnmTjFUisJHePNtdsS0Ue UsU21D3+qIo0V9GbUyiFwXL9WCos+zufvvL7gvpC4WIO9kkWbeH6W4UmYffrU+mpNfF3 igKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language:in-reply-to:mime-version :user-agent:date:message-id:organization:openpgp:references:cc:to :from:subject; bh=7i993M8/9kd2H7bsDCrstMn4gW3JlHu8FJRJWDIg3b4=; b=rWtMUcVioHPcjvgfBTVBbWJzu+QzhvL4QLB+rZnwwWUUbbIbLKbWIl69D/hWphUFVM Ey/kXdvN3Ec0jlgO3VMLq8PSTZyUCDiMFXpBm6znjXcFJypeVHqiEBtNzA0JPHpnpP0x qpzFA2Zcfq7n4Ppye4M8fFt1D/46eiZrSvKpbqGfFRumHvy155kv9cnLDRI68tWPTf6F u7LRe8Da05hjX0e/HYzpeOIoAavERUvesiJiP4L6HiB8WRWx346prj40NDKE9iCX9LDr K2o2Tz2Fha67U0La4fbmB2/OyIDJQD86bBwg9yUlM+cJ4yvMCi1qqkaJRQdsMy3IZUp/ sHow== 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 g129si23977411pfb.181.2019.06.04.08.44.40; Tue, 04 Jun 2019 08:44:58 -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 S1728190AbfFDPlv (ORCPT + 99 others); Tue, 4 Jun 2019 11:41:51 -0400 Received: from mx2.suse.de ([195.135.220.15]:53058 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728115AbfFDPlv (ORCPT ); Tue, 4 Jun 2019 11:41:51 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 2F140AE8A; Tue, 4 Jun 2019 15:41:49 +0000 (UTC) Subject: Re: bcache: oops when writing to writeback_percent without a cache device From: Coly Li To: =?UTF-8?Q?Bj=c3=b8rn_Forsman?= Cc: Kent Overstreet , linux-bcache@vger.kernel.org, LKML References: <6823d3ab-5f93-da74-0dbc-19bdb7be6907@suse.de> Openpgp: preference=signencrypt Organization: SUSE Labs Message-ID: <3399cad5-4387-dd23-77f1-a70e551fb531@suse.de> Date: Tue, 4 Jun 2019 23:41:43 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: <6823d3ab-5f93-da74-0dbc-19bdb7be6907@suse.de> Content-Type: multipart/mixed; boundary="------------102620AF45697B91F3AE3BB5" Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a multi-part message in MIME format. --------------102620AF45697B91F3AE3BB5 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit On 2019/6/4 10:59 下午, Coly Li wrote: > On 2019/6/4 7:00 下午, Bjørn Forsman wrote: >> Hi all, >> >> I get a kernel oops from bcache when writing to >> /sys/block/bcache0/bcache/writeback_percent and there is no attached >> cache device. See the oops itself below my signature. >> >> This is on Linux 4.19.46. I looked in git and see many commits to >> bcache lately, but none seem to address this particular issue. >> >> Background: I'm writing to .../writeback_percent with >> systemd-tmpfiles. I'd rather not replace it with a script that figures >> out whether or not the kernel will oops if writing to the sysfs file >> -- the kernel should not oops in the first place. > > Hi Bjorn, > > Thank you for the reporting. I believe this is a case we missed in > testings. When a bcache device is not attached, it does not make sense > to update the writeback rate in period by the changing of writeback_percent. > > I will post a patch for your testing soon. Hi Bjorn, Could you please to try this patch ? Hope it may help a bit. Thanks. Coly Li >> >> Jun 04 12:35:42 kernel: BUG: unable to handle kernel NULL pointer >> dereference at 0000000000000340 >> Jun 04 12:35:42 kernel: PGD 0 P4D 0 >> Jun 04 12:35:42 kernel: Oops: 0000 [#1] SMP PTI >> Jun 04 12:35:42 kernel: CPU: 6 PID: 20266 Comm: kworker/6:220 Not >> tainted 4.19.46 #1-NixOS >> Jun 04 12:35:42 kernel: Hardware name: To Be Filled By O.E.M. To Be >> Filled By O.E.M./X99 Extreme4/3.1, BIOS P3.60 04/06/2018 >> Jun 04 12:35:42 kernel: Workqueue: events update_writeback_rate [bcache] >> Jun 04 12:35:42 kernel: RIP: 0010:update_writeback_rate+0x2f/0x2e0 [bcache] [snipped] --------------102620AF45697B91F3AE3BB5 Content-Type: text/plain; charset=UTF-8; x-mac-type="0"; x-mac-creator="0"; name="0001-bcache-only-set-BCACHE_DEV_WB_RUNNING-when-cached-de.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename*0="0001-bcache-only-set-BCACHE_DEV_WB_RUNNING-when-cached-de.pa"; filename*1="tch" RnJvbSA5ZGVhMWU2YWQwZTZjNDBlM2JjNmVlNmNmNGFkMjQzYzA3Y2E2Y2E5IE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBDb2x5IExpIDxjb2x5bGlAc3VzZS5kZT4KRGF0ZTog VHVlLCA0IEp1biAyMDE5IDIzOjI0OjA5ICswODAwClN1YmplY3Q6IFtQQVRDSF0gYmNhY2hl OiBvbmx5IHNldCBCQ0FDSEVfREVWX1dCX1JVTk5JTkcgd2hlbiBjYWNoZWQgZGV2aWNlCiBh dHRhY2hlZAoKV2hlbiBwZW9wbGUgc2V0IGEgd3JpdGViYWNrIHBlcmNlbnQgdmlhIHN5c2Zz IGZpbGUsCiAgL3N5cy9ibG9jay9iY2FjaGU8Tj4vYmNhY2hlL3dyaXRlYmFja19wZXJjZW50 CmN1cnJlbnQgY29kZSBkaXJlY3RseSBzZXRzIEJDQUNIRV9ERVZfV0JfUlVOTklORyB0byBk Yy0+ZGlzay5mbGFncwphbmQgc2NoZWR1bGVzIGt3b3JrZXIgZGMtPndyaXRlYmFja19yYXRl X3VwZGF0ZS4KCklmIHRoZXJlIGlzIG5vIGNhY2hlIHNldCBhdHRhY2hlZCB0bywgdGhlIHdy aXRlYmFjIGtlcm5lbCB0aHJlYWQgaXMKbm90IHJ1bm5pbmcgaW5kZWVkLCBydW5uaW5nIGRj LT53cml0ZWJhY2tfcmF0ZV91cGRhdGUgZG9lcyBub3QgbWFrZQpzZW5zZSBhbmQgbWF5IGNh dXNlIE5VTEwgcG9pbnRlciBkZWZlcmVuY2Ugd2hlbiByZWZlcmVuY2UgY2FjaGUgc2V0CnBv aW50Z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