From patchwork Wed Mar 27 16:11:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Martin K. Petersen" X-Patchwork-Id: 10873741 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E1BC917E0 for ; Wed, 27 Mar 2019 16:12:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C8C2E28CE2 for ; Wed, 27 Mar 2019 16:12:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD69028DD5; Wed, 27 Mar 2019 16:12:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6106828CE2 for ; Wed, 27 Mar 2019 16:12:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727158AbfC0QMM (ORCPT ); Wed, 27 Mar 2019 12:12:12 -0400 Received: from aserp2130.oracle.com ([141.146.126.79]:45680 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726695AbfC0QMM (ORCPT ); Wed, 27 Mar 2019 12:12:12 -0400 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x2RG9P2h169421; Wed, 27 Mar 2019 16:11:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2018-07-02; bh=JYAr4Mu9ANusi5MMIKZa8aPeO8xwmC8KY06npFEREWE=; b=H2YCgDLGwj8S5wwFMidF9Qy5P01XGPgR1cyhZ0/1iWDPrYWDP+y9aWQrvEUHP/wdQIbA mXtES0VxxA8h8rYssqsfqphMXI6YPKCeBpNB5M90McaDcbB84OpnEHbfKS8ghB+GashN xA5/qGz81TmTijsXaf6tQ+Xy2MCqUOvY6GNKdgnrOyMvWOZLb7lSdkSNjq8W78DYoTzP YLVtQfOCme2vnj0KcIQCuYUIuVzP1F+tyrDbJhv+cZNK5v5OW1+ZgI/aqzfV09aRYAWb NeISWk6/Y21AK82SL+4/3gP50Gwt5lunq5Zb84C7r2UvOWIVkQ68ZgaLmznrgbfqwryF dA== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2130.oracle.com with ESMTP id 2re6g11kfv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2019 16:11:56 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id x2RGBtMB028288 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 27 Mar 2019 16:11:55 GMT Received: from abhmp0015.oracle.com (abhmp0015.oracle.com [141.146.116.21]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x2RGBrjQ030634; Wed, 27 Mar 2019 16:11:54 GMT Received: from ca-mkp.ca.oracle.com (/10.156.108.201) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 27 Mar 2019 09:11:53 -0700 From: "Martin K. Petersen" To: linux-scsi@vger.kernel.org Cc: "Martin K. Petersen" , Hussam Al-Tayeb , Randy Dunlap , stable@vger.kernel.org Subject: [PATCH] scsi: sd: Quiesce warning if device does not report optimal I/O size Date: Wed, 27 Mar 2019 12:11:52 -0400 Message-Id: <20190327161152.23401-1-martin.petersen@oracle.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <25d0ddcb-b603-6e0d-d512-b188813837bf@infradead.org> References: <25d0ddcb-b603-6e0d-d512-b188813837bf@infradead.org> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9207 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903270113 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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") Reported-by: Hussam Al-Tayeb Cc: Randy Dunlap Cc: Signed-off-by: Martin K. Petersen Reviewed-by: Bart Van Assche --- drivers/scsi/sd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 9d8e15d03d2b..87d542de2db7 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -3074,6 +3074,9 @@ static bool sd_validate_opt_xfer_size(struct scsi_disk *sdkp, 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 " \