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 0B3E3C43381 for ; Mon, 1 Apr 2019 17:23:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D0F9F206C0 for ; Mon, 1 Apr 2019 17:23:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554139438; bh=qIzGQvsRA+L81bippzeCctihcbCfDiXdrTqKSfVWJz4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=zDGwzPAtMm+qvxI1e5IxGKRZ3kt9GFcG7R39Ag5lTidWs1K64pkeMa/8jTNMuzM5S E/WjVCtgFxHNlk4phDoFVZSymrK2qLMIsVvpqpiQSWAODMS4B3PbmJ/VzIWEkQyezc IlD1h/3HVp4Z28NS/Rp3GRJanstU1v/lGf1t5ZSE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732195AbfDARX5 (ORCPT ); Mon, 1 Apr 2019 13:23:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:54008 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732178AbfDARXx (ORCPT ); Mon, 1 Apr 2019 13:23:53 -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 925C2206C0; Mon, 1 Apr 2019 17:23:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1554139433; bh=qIzGQvsRA+L81bippzeCctihcbCfDiXdrTqKSfVWJz4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DEBy2VzKN8ilSUh9WEpLusM8Dd6EuFj5j/Nazs2q9VRopV6YeSiMPVsRlXb9GTjnP rYsQGByWw1Js7IgoTp1dJtIIlC41KrHcGg9wVWpS0T4xmWGgDb1KzmzkEDQRZDTfxb YXERw1Rl0Ww5kNsMLo1AYbHnsUmjnbz0Md10dv1w= 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.14 073/107] scsi: sd: Quiesce warning if device does not report optimal I/O size Date: Mon, 1 Apr 2019 19:02:28 +0200 Message-Id: <20190401170052.290685749@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190401170045.246405031@linuxfoundation.org> References: <20190401170045.246405031@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.14-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 @@ -3084,6 +3084,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 " \