Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2746726imj; Mon, 11 Feb 2019 07:53:46 -0800 (PST) X-Google-Smtp-Source: AHgI3IZfTHZCVCA8RXcI4L9vQqOmHGyKOHXJaqhFCqfLPs41sKGEmYcJEiK0LM0CXmxkpHjcBfFA X-Received: by 2002:a63:194f:: with SMTP id 15mr29556378pgz.192.1549900426747; Mon, 11 Feb 2019 07:53:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549900426; cv=none; d=google.com; s=arc-20160816; b=LgchwXzamjBe34rKcqcEpEMTExhdD4UMRgKAVcH04jC9BeuuUQxohI80paQnx1OZYm FZqM+NrP3AmITfykwR0Im7YPzgXJCvGQZHjYSkqM95ahmqkY4PSRsUveiJMxDwJG974u 9AkAMDxE4aSdi3B3qOba+l8jVk0pkrZtjYliHKDBrmZroV2Ibeg2ZffS/J3iWhxxJLkN YyeUshGpRlrHd4KQdMm+PpMpYhRJystLgilJn94RD9S6DKt1CwwxkrJTsVI3UUsqZXNv ZSiv7gDkeM9x7h14Je3n3V4c21Qdvzc5wtR7aaJSFmywACbXmii2jlGweed4omZuMm2f ux0Q== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JDaFecAb3+7v+CVkQWfGesmQR7+v8e6opyGKwuzaSqU=; b=jvSH36aLmM3TIaxqME657z1ncjaftVa0lA1fkzBDhYjzS8hYe4upwODmF/waiBLfc5 mewUVxeRF+4pSeAwWjkPTB9mr8R8XTaLSiNVSCbZxydFEbB5Y70+T/zlQlbUoCGxbhx2 q6Qq978aVGtpDlQ8EXdPTRKTW7oPwdRS4x2QY4Qkza+kUClJyNnbhGo25/CV+ZCXQ338 JNFZZA6hj3nB6L6AjFkuF8Pxt7b0qblOsEvBwyYvs/lAOtspu4ye/nAGGQOwj1ibcu/z UpCk4Ppnj/6fclkDIF0racvv9023colVF/3HpFaQIkMUz75cREQRRNzZ3yp5agjz1r9t 4LSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lwgQlF11; 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 h33si3942973pgl.157.2019.02.11.07.53.29; Mon, 11 Feb 2019 07:53:46 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=lwgQlF11; 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 S1728591AbfBKPwh (ORCPT + 99 others); Mon, 11 Feb 2019 10:52:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:46472 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731400AbfBKOhL (ORCPT ); Mon, 11 Feb 2019 09:37:11 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 893DD20700; Mon, 11 Feb 2019 14:37:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895831; bh=Ssmq42dyYH0ghnib7FEJPklZDcQ4Fhc3zxLADoM2Ci4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lwgQlF11BdKZDfrZwtLoMMk6MwdafdXmNLgLu4KdKi/6qiHyvSGamf/hbrx9dE+YU 5GwXZst04EPXldHA+wfys3RL4KP05Qk90YsCgx0B3+WvnLsxt4dpAkupFdU2shuOox FEG7WnYPzzvlsp0KfDX0UXjLipWKuLTM76ZS2IJ4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Damien Le Moal , "Martin K. Petersen" Subject: [PATCH 4.20 336/352] scsi: sd_zbc: Fix zone information messages Date: Mon, 11 Feb 2019 15:19:23 +0100 Message-Id: <20190211141908.485761888@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Damien Le Moal commit 88fc41c407158a7d2eaa4b2f7cfa289749d456c6 upstream. Commit bf5054569653 ("block: Introduce blk_revalidate_disk_zones()") inadvertently broke the message output of sd_zbc_print_zones() because the zone information initialization of the scsi disk structure was moved to the second scan run while sd_zbc_print_zones() is called on the first scan. This leads to the following incorrect message to be printed for any ZBC or ZAC zoned disks. "...[sdX] 4294967295 zones of 0 logical blocks + 1 runt zone" Fix this by initializing sdkp zone size and number of zones early on the first scan. This does not impact the execution of blk_revalidate_zones(). This functions is still called only once the block device capacity is set on the second revalidate run on boot, or if the disk zone configuration changed (i.e. the disk changed). Fixes: bf5054569653 ("block: Introduce blk_revalidate_disk_zones()") Cc: stable@vger.kernel.org Signed-off-by: Damien Le Moal Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/sd_zbc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) --- a/drivers/scsi/sd_zbc.c +++ b/drivers/scsi/sd_zbc.c @@ -462,12 +462,16 @@ int sd_zbc_read_zones(struct scsi_disk * sdkp->device->use_10_for_rw = 0; /* - * If something changed, revalidate the disk zone bitmaps once we have - * the capacity, that is on the second revalidate execution during disk - * scan and always during normal revalidate. + * Revalidate the disk zone bitmaps once the block device capacity is + * set on the second revalidate execution during disk scan and if + * something changed when executing a normal revalidate. */ - if (sdkp->first_scan) + if (sdkp->first_scan) { + sdkp->zone_blocks = zone_blocks; + sdkp->nr_zones = nr_zones; return 0; + } + if (sdkp->zone_blocks != zone_blocks || sdkp->nr_zones != nr_zones || disk->queue->nr_zones != nr_zones) {