Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp375131pxa; Tue, 4 Aug 2020 07:42:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrust4Zg/xv5LJsocclqBdrQuKRI+quizVej25+zEJVkF5VgApuZ54I42qzvVa6dUc/mBG X-Received: by 2002:a05:6402:a5b:: with SMTP id bt27mr21298848edb.120.1596552160212; Tue, 04 Aug 2020 07:42:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1596552160; cv=pass; d=google.com; s=arc-20160816; b=Fp34hv/ztSG5900vwR6kJgjPsvL0DsR2aeJZfi9a8T+GtnvpHFVDG5m1jSoY2cltT0 sFoBuAQpvOAh8qKyXq0fMDw1mTrj29eEapQcNoYNmoYuA/OyyXJeFnK/Ttmbpmnk7kdb DMqTIimYX9nYt/iFwpdJJuOR8L06F7W6vSZc4I6yd9tTJUiKwJh5K9bLC/VNy2BCRwwG y64usp24w3slps9PMmsIH8euf1KrikDUirncMRIw5z48+cmNxntMGMtkaPewQSomfyQH feLZj/vlSCpDFAMTNjw8gmhfmWVtHef0UzCtWNFKCcnD48rZNN0w644kDFRcvSaYuU4k p98w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :wdcipoutbound:content-language:accept-language:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature:ironport-sdr:dkim-signature; bh=n8gkZtgQGVsA1iIp87w4FQ5oBwuqqXhY6pyQFOm99MI=; b=NlWnr2W+BRz9/c5oZ28IlImxVaEreSpbbS2ne78PT98oCZQwsPAFH7iSO7/GKfd1eL GffCJhnJhLwQqyN1lpTAcHfRodsGOFNzFsVTfWolYxwhtvO5FB1XOmJbHCcnj7uYYP47 qk52hKmeAA7VHFhuPtZ7w9k0u6BZJnZKkf0vVYYzIuivOYEGp2BKarZCWcJ7UWR0T6Uq r0lENzy459tapGCZLm942mMSMgPwiwgbRADYNUrHqlGVlo+TtdAe8LbbP9eU5WG4WGZE MyqouPeDJD8VafbUlOHPaSwODTYNrItO0nAYl9xCgbLMH6CDJgLRV3ET3HAcS3l+GJaS APgw== ARC-Authentication-Results: i=2; mx.google.com; dkim=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=CcMOtnK5; dkim=pass header.i=@sharedspace.onmicrosoft.com header.s=selector2-sharedspace-onmicrosoft-com header.b=O5c+3376; arc=pass (i=1 spf=pass spfdomain=wdc.com dkim=pass dkdomain=wdc.com dmarc=pass fromdomain=wdc.com); 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=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p25si12689350ejc.560.2020.08.04.07.42.16; Tue, 04 Aug 2020 07:42:40 -0700 (PDT) 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=fail header.i=@wdc.com header.s=dkim.wdc.com header.b=CcMOtnK5; dkim=pass header.i=@sharedspace.onmicrosoft.com header.s=selector2-sharedspace-onmicrosoft-com header.b=O5c+3376; arc=pass (i=1 spf=pass spfdomain=wdc.com dkim=pass dkdomain=wdc.com dmarc=pass fromdomain=wdc.com); 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=fail (p=NONE sp=NONE dis=NONE) header.from=wdc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729206AbgHDOkM (ORCPT + 99 others); Tue, 4 Aug 2020 10:40:12 -0400 Received: from esa4.hgst.iphmx.com ([216.71.154.42]:23291 "EHLO esa4.hgst.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728157AbgHDOkA (ORCPT ); Tue, 4 Aug 2020 10:40:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1596551999; x=1628087999; h=from:to:cc:subject:date:message-id:references: content-transfer-encoding:mime-version; bh=wbf025ctdBheET/PwuKdmRItCq6BInNbJnhEPqQTi1g=; b=CcMOtnK5UENI+qXLI87gCnlX2ZzsPyWPrjWIjSdQCPtz8kqZ/JIzwToV 9cSSOl6lHzAwAv77G7Itsaa394kQlIiR3SMDAeKutUtSprp9MtRHLSD5E QgZ8kBZyw8FZhwBwFyp2fm5S4AmTt/eL7XhQ/dPGxtwLlAVhlH31ZM7dG DoY6Egfc6QsUXX4EDIMjaJRF2xwZZGB7VattvwF4hriQBAxTDiHxJK36Z 0WOrCsdnPv3FMpqR+JzU1pabLGM+h+Q9ipwrnTG4iCTHw2iBsGw6hzify jKMBnuHN/BdwWrVMj/T7eJXkq9kdLVgO/V8Jz7mfmJ5B8AP+8I85ehRoI A==; IronPort-SDR: NNRzA7xpwhK+sSZfroOiSR5AKwcGYTN/55aqyQghOeQZHOIFLGay/KRfOM04nYhcLKaFwmSAFP UhAfD2do47NmjrDq+sNbSmfbR8YNzb60Hbq+62xqFp5rL5oyw3wr6j97UwrLyA19kSTU/8BaG7 OZ8Mk9vH2ei7TOWoWZHTqet1hQNzupzjg6k/BZsLTaHF5j/rjpzG0yg0dAGBPJwvRudzzEdjUN d4u0R+DzWVYsMkbbB+RapK7Q3VfREeFmti1Zh5vSzGHPqeKfVpkF7VvlwV63o3VwlP3AtrbAtT 6SU= X-IronPort-AV: E=Sophos;i="5.75,434,1589212800"; d="scan'208";a="144114634" Received: from mail-bn8nam12lp2170.outbound.protection.outlook.com (HELO NAM12-BN8-obe.outbound.protection.outlook.com) ([104.47.55.170]) by ob1.hgst.iphmx.com with ESMTP; 04 Aug 2020 22:39:58 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZDTbPq75/gbLJKsemQbpsV9PU+/7u82g6ZEBD6SDVVvN5O4mfl0iPje62N7HFjfTXjpzQjRoboGyb+okcVRF/cayJB/goDB5JpyveRaqGAwOM87XNhpd8wW3t17pkMr4h6j7TS77Kaka77cXORuKzostBkpD23+Se8f8jFJse6uSYMQo1ievbIMrBvStfGtZH9wlb5uKcwibUtVdoHPlI40k9MhdYmePCwkaSNMZLzBAbmgs2DMX+u5ORXapuWxLhPPuDSaMf93PZ4U1fn9ZDEVIMcARMLD8imux0bT6VELwu6LwvNpx9tYlLVZKiMHXTXIpaQpmKoyuIaIIRawzJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=n8gkZtgQGVsA1iIp87w4FQ5oBwuqqXhY6pyQFOm99MI=; b=PoI/VSQCWVKsWyvW80h9EAV7/IoWFUxxvMVkC1ow9cejWUBKEvziTm5fFNMRtpEdHZNFG8g7ITxK4YVY9O0nMxlq+cMhRSeh0w/K9tRqCEVC/z0NiM7+w2MbJSL4DxvTYG7JDHiUpMbCfFy+WwV+hHdrp+saRZzSch9YmTtT1JmZsBCM6kfeFHsIUOYWWYObNmPmB0yUWAz1AyC1AqjR5Uqpo2LKY1wg+wrkJKt7v/fMo/R+ZZqStn9wmIklGpaw4ROHLC1hmOB9aYTwtVRWSNkfUQTDWPNzmXUZBZXuzg2pUzFtVGBcPS8a4O0o5K5b3q10VjIZjGDeaMedCeEKQg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wdc.com; dmarc=pass action=none header.from=wdc.com; dkim=pass header.d=wdc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=n8gkZtgQGVsA1iIp87w4FQ5oBwuqqXhY6pyQFOm99MI=; b=O5c+3376cQN8FTb9zMzoZegclppUtGYQqFYDF4DuNotvbZ6dilLV0DA3aVBBvtxsSfJCoUfnf1zeE6h7mnSSTa4TEy+H2BEGbYXFg7AEdUvpMkUwvff0pTrUsJQJzqeREI8MgWyWUXzw6+cNGLIa7lStd3jE+ZSKKDTHopHFSOM= Received: from SN4PR0401MB3598.namprd04.prod.outlook.com (2603:10b6:803:47::21) by SN6PR04MB4317.namprd04.prod.outlook.com (2603:10b6:805:2f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.17; Tue, 4 Aug 2020 14:39:57 +0000 Received: from SN4PR0401MB3598.namprd04.prod.outlook.com ([fe80::457e:5fe9:2ae3:e738]) by SN4PR0401MB3598.namprd04.prod.outlook.com ([fe80::457e:5fe9:2ae3:e738%7]) with mapi id 15.20.3239.021; Tue, 4 Aug 2020 14:39:57 +0000 From: Johannes Thumshirn To: Coly Li , "linux-block@vger.kernel.org" CC: "linux-bcache@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Ming Lei , Hannes Reinecke , Xiao Ni , Bart Van Assche , Christoph Hellwig , Enzo Matsumiya , Jens Axboe , Evan Green Subject: Re: [PATCH] block: tolerate 0 byte discard_granularity in __blkdev_issue_discard() Thread-Topic: [PATCH] block: tolerate 0 byte discard_granularity in __blkdev_issue_discard() Thread-Index: AQHWamrhOskbhhn9f0O9q4CKi9C/MA== Date: Tue, 4 Aug 2020 14:39:56 +0000 Message-ID: References: <20200804142332.29961-1-colyli@suse.de> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: suse.de; dkim=none (message not signed) header.d=none;suse.de; dmarc=none action=none header.from=wdc.com; x-originating-ip: [129.253.240.72] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 9febf1dc-02be-4aca-a42f-08d83884422e x-ms-traffictypediagnostic: SN6PR04MB4317: x-microsoft-antispam-prvs: wdcipoutbound: EOP-TRUE x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 0hgLKaoWCWT16nQSoKktfbam6SZaqLZIq2uH2lbhGthH5IwmtF5BKTXU0xxVrL/fuacSdtJgIuIA3pxJXlRQolF4fRVTsL6A3kCypq/WXcUMkrl6pbh8Gn85DPOsxL0m7hDJymGGVnYaeQhgeAEPfO86H8Xot69qb/A2y0ymZtECoEyleKpQ4mNjTouK2E8b1fbsmiPE5b7STgAPHIQWB6+SDVV+lBt734/PknyjslBaWQOOn7OfY46FVGMHJGyITQazjG1XmRQNhupZ/dUyzbu0AlbsCF7hxbeTVDuO2Z9CCHUn09IEfISDa7xsfB4hxW54/8VuvS6Zp9ZUxOLJNw== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN4PR0401MB3598.namprd04.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(396003)(39850400004)(376002)(366004)(346002)(136003)(316002)(8676002)(71200400001)(4326008)(186003)(8936002)(110136005)(26005)(2906002)(66476007)(66446008)(64756008)(66556008)(5660300002)(54906003)(66946007)(33656002)(91956017)(76116006)(478600001)(9686003)(7696005)(7416002)(53546011)(6506007)(52536014)(55016002)(86362001)(83380400001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: r0hIx4idDr6qxRgYgYrn7qp/SAZ+Ehl+7//bysL0dNtDSGGEUa0M/FAjorKT4Rt/pjPiwZ86DanXmPAhoWpqVblJZ4eHvi3sAkU1tuWL18tCJjRxe3GS7CAfiTJ906FTEZ4v0VHXgsDFtFplSU2Tq11VxLJyqXUjUaFB6Ji4zTLZmBS+JvDCWXpp3kR66TkbSOUeLDa/dLnpZmVDxL+c291djGTTsgqhhiXfnXSdKCa7hyRV6o9ij7Z7qokzs5Q9TKUjWFdwPQO7FB+Ap3GUyP88dB+Uxi4R51YRB6K2wiQORvq+PCMRyuqFOykLdoKZnslMeLOkiP0R0JJx8NIsgU40ZCDXuTD2wpEwiIfeB/gTzOYXvCum95u6iMUtuQf+wqe2ZsJI5HXgBNgZl2CMFEF/dnza7wCnR5v8CZdub/2C7n7sSQi5CI/g0q1Hk5+5CH2ijCEYlQhqkZM80dgSZP9F/j7Arla92koH9q8FAiPw/jMPxhnSDZqjUFu/TSL3ZY8dz/DuRT3B3F1nsm9pgKDWWR28i3V3w1Vyohh7N19Ai4ck9B7W2U9aAhmi9FBxbohVuFDAiHK8NM7fqwP3FlbIRou0YZEwcPd2LIoBustiMLlKuRD9MMsu0YABhywYAy3nq2S+DBiBkeF2qxAfjg== x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN4PR0401MB3598.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9febf1dc-02be-4aca-a42f-08d83884422e X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Aug 2020 14:39:56.8987 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: LDMw2OUG3dRA3e7UzNzq+SoOeze1lICK9vz2EAub4yFBagesN8yFrnF3TgUKTC3k6UKD20c7U2IAreNqADJFZPRIRpdoiPoR2l4muxifARE= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN6PR04MB4317 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 04/08/2020 16:37, Johannes Thumshirn wrote:=0A= > On 04/08/2020 16:34, Coly Li wrote:=0A= >> On 2020/8/4 22:31, Johannes Thumshirn wrote:=0A= >>> On 04/08/2020 16:23, Coly Li wrote:=0A= >>>> This is the procedure to reproduce the panic,=0A= >>>> # modprobe scsi_debug delay=3D0 dev_size_mb=3D2048 max_queue=3D1=0A= >>>> # losetup -f /dev/nvme0n1 --direct-io=3Don=0A= >>>> # blkdiscard /dev/loop0 -o 0 -l 0x200=0A= >>>=0A= >>> losetup -f /dev/sdX isn't it?=0A= >>>=0A= >>=0A= >> In my case, I use a NVMe SSD as the backing device of the loop device.= =0A= >> Because I don't have a scsi lun.=0A= >>=0A= >> And loading scsi_debug module seems necessary, otherwise the discard=0A= >> process just hang and I cannot see the kernel panic (I don't know why ye= t).=0A= > =0A= > OK, now that's highly interesting. Does it also happen if you back loop w= ith=0A= > a file? loop_config_discard() has different cases for the different backi= ng devices/files. S=0A= > =0A= =0A= Damn I didn't want to hit sent....=0A= =0A= Does this (untested) change make a difference:=0A= =0A= diff --git a/drivers/block/loop.c b/drivers/block/loop.c=0A= index 475e1a738560..8a07a89d702e 100644=0A= --- a/drivers/block/loop.c=0A= +++ b/drivers/block/loop.c=0A= @@ -895,6 +895,9 @@ static void loop_config_discard(struct loop_device *lo)= =0A= blk_queue_max_write_zeroes_sectors(q,=0A= backingq->limits.max_write_zeroes_sectors);=0A= =0A= + q->limits.discard_granularity =3D=0A= + backingq->limits.discard_granularity;=0A= +=0A= /*=0A= * We use punch hole to reclaim the free space used by the=0A= * image a.k.a. discard. However we do not support discard if=0A= =0A=