From patchwork Wed Mar 14 16:15:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Martin K. Petersen" X-Patchwork-Id: 10282645 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1A7616061F for ; Wed, 14 Mar 2018 16:16:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C9F628405 for ; Wed, 14 Mar 2018 16:16:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0096328418; Wed, 14 Mar 2018 16:16:00 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, 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 81FD828405 for ; Wed, 14 Mar 2018 16:16:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751406AbeCNQP7 (ORCPT ); Wed, 14 Mar 2018 12:15:59 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:55646 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750862AbeCNQP7 (ORCPT ); Wed, 14 Mar 2018 12:15:59 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w2EGEoi1185896 for ; Wed, 14 Mar 2018 16:15:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2017-10-26; bh=WWLNXXUmvheFGyaeRsJetmMBMQ51W8AUmQVD2tD3cl0=; b=kwQzdEcwF71xxU5tiruNJCgXM+gh3/EmxPnyPuojwZsJaqP7f0NSO6QxRtCUK72d2rdi Eak1kYRyQgIaMns0DGvV+VGIkdeuKDDa+1/u6x5DAio3EcufYr6vG8xAvcSQivq47Od2 t51x5TMWXw9kucErWOir6gb6gex24UsBnZ+Zz2f0VCcvAD3wQ1LwfMumMc5SsqRkAdEP oEFI5l28nZ3tEjL1MoVWtlscVd7on8Co4xfU0QUTl3YwS1l8FkShBmJirYmzwjD9XUGa SnUh2QIuDtBFterLCjgmZdz8gnJ38kifIcyJqVRgsb6CoDrARBsI7VS4X5ChBJyUVBde tg== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2120.oracle.com with ESMTP id 2gq6r584h1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 14 Mar 2018 16:15:58 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w2EGFvlj031025 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 14 Mar 2018 16:15:57 GMT Received: from abhmp0014.oracle.com (abhmp0014.oracle.com [141.146.116.20]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w2EGFv8p008562 for ; Wed, 14 Mar 2018 16:15:57 GMT Received: from ca-mkp.ca.oracle.com (/10.156.108.201) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 14 Mar 2018 09:15:57 -0700 From: "Martin K. Petersen" To: linux-scsi@vger.kernel.org Cc: "Martin K. Petersen" Subject: [PATCH] scsi: sd: Remember that READ CAPACITY(16) succeeded Date: Wed, 14 Mar 2018 12:15:56 -0400 Message-Id: <20180314161556.12860-1-martin.petersen@oracle.com> X-Mailer: git-send-email 2.14.1 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8832 signatures=668690 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=1 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=400 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1803140183 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 The USB storage glue sets the try_rc_10_first flag in an attempt to avoid wedging poorly implemented legacy USB devices. If the device capacity is too large to be expressed in the provided response buffer field of READ CAPACITY(10), a well-behaved device will set the reported capacity to 0xFFFFFFFF. We will then attempt to issue a READ CAPACITY(16) to obtain the real capacity. Since this part of the discovery logic is not covered by the first_scan flag, a warning will be printed a couple of times times per revalidate attempt if we upgrade from READ CAPACITY(10) to READ CAPACITY(16). Remember that we have successfully issued READ CAPACITY(16) so we can take the fast path on subsequent revalidate attempts. Reported-by: Menion Signed-off-by: Martin K. Petersen Reviewed-by: Laurence Oberman Reviewed-by: Bart Van Assche --- drivers/scsi/sd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index bff21e636ddd..6e971b94af7d 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2484,6 +2484,8 @@ sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer) sector_size = old_sector_size; goto got_data; } + /* Remember that READ CAPACITY(16) succeeded */ + sdp->try_rc_10_first = 0; } }