From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C89CEC4360F for ; Mon, 1 Apr 2019 17:27:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9B06F20830 for ; Mon, 1 Apr 2019 17:27:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554139652; bh=Jv41VfsvgsbjicXBWyKNv9xmCj2U9ASdiCXbIcb3ihE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=wkdj3qNLfmSJY+jH3qHbUi1scrYSv/TM8Qc/KaZ+JyAHW/3krZDKsBVIBN4f2CbKI 7uD+Gx+y3bTZmvEAnFWfdsPdFwwGF05yzv+lbnfdmqIIqUUWjmPGtyk2prF1mlE7tV maEgxVGOjcoSsWw+I0QH99T0SUtPdFOiJx3uWDKA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732648AbfDAR1b (ORCPT ); Mon, 1 Apr 2019 13:27:31 -0400 Received: from mail.kernel.org ([198.145.29.99]:60872 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732674AbfDAR12 (ORCPT ); Mon, 1 Apr 2019 13:27:28 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 914662063F; Mon, 1 Apr 2019 17:27:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554139648; bh=Jv41VfsvgsbjicXBWyKNv9xmCj2U9ASdiCXbIcb3ihE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iUWiLr3PCmIAT5yQdh+9ielpaZrXDMZZ6ZXrTwU2fhCbdp1/2OeYbJ2277IJNPvSU m5M7RVc5WBpu9UBQebn0ZXibWc2lA5+PelmnSJtwLK8UHOIUo6EjlqAhzgy0WVwqkf lhHxwuqB1vI0QZSsVPYoahSRTzlnZ5/K8haMlz28= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Randy Dunlap , Hussam Al-Tayeb , Bart Van Assche , "Martin K. Petersen" Subject: [PATCH 4.9 29/56] scsi: sd: Quiesce warning if device does not report optimal I/O size Date: Mon, 1 Apr 2019 19:02:45 +0200 Message-Id: <20190401170105.533615559@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190401170103.398401360@linuxfoundation.org> References: <20190401170103.398401360@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: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Martin K. Petersen commit 1d5de5bd311be7cd54f02f7cd164f0349a75c876 upstream. Commit a83da8a4509d ("scsi: sd: Optimal I/O size should be a multiple of physical block size") split one conditional into several separate statements in an effort to provide more accurate warning messages when a device reports a nonsensical value. However, this reorganization accidentally dropped the precondition of the reported value being larger than zero. This lead to a warning getting emitted on devices that do not report an optimal I/O size at all. Remain silent if a device does not report an optimal I/O size. Fixes: a83da8a4509d ("scsi: sd: Optimal I/O size should be a multiple of physical block size") Cc: Randy Dunlap Cc: Reported-by: Hussam Al-Tayeb Tested-by: Hussam Al-Tayeb Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/sd.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2841,6 +2841,9 @@ static bool sd_validate_opt_xfer_size(st unsigned int opt_xfer_bytes = logical_to_bytes(sdp, sdkp->opt_xfer_blocks); + if (sdkp->opt_xfer_blocks == 0) + return false; + if (sdkp->opt_xfer_blocks > dev_max) { sd_first_printk(KERN_WARNING, sdkp, "Optimal transfer size %u logical blocks " \