Received: by 2002:ac0:aa62:0:0:0:0:0 with SMTP id w31-v6csp1932077ima; Thu, 25 Oct 2018 07:13:10 -0700 (PDT) X-Google-Smtp-Source: AJdET5dQA7DD9xfaV4+mGWgE0UldoD/HvOXvSA/Bhinu+DN0j0WyW47vR2H0djXUSVBnIlwfeD/Y X-Received: by 2002:a62:939d:: with SMTP id r29-v6mr1744207pfk.55.1540476790541; Thu, 25 Oct 2018 07:13:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1540476790; cv=none; d=google.com; s=arc-20160816; b=l+DDFTUhSRs5Br8H9Mzxpg9brdN/GDVg8/9EQUuccT8tXBjzuK177viI5TrwKjL/vs TZ93kt2UIkI3kfrZAOdQhpn6A1TuThC6R2WV/+JsmGw9GJff1CuQkcYGkFgaYtpeK6AA zUQBW3H021/rFwSezlejtceDPcOphK2nC1rYWxZXFO9CMOFb/xVZot9uXOmN8c329SSj QHFGSCMPczuNIV82BFdjiOKwHdTTIEih7eDG/yM9jdbJ6Qcl/hZghkZWzmu8c7IOOuci lO/oyYxkJO4rGyVPP6a57NZU4ZTkAa8daJiwHbDxetQsG5KWA4PcdxP6hXT5ugvD95dC FrHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=DX+6CTF8X0c8oNVOiXwccvYdsoqYHvKP9n8y5fn5wYI=; b=czUPbx0AflWxGERqV3VO8dRscMmsRhfYR9I5LiXjRpR7WPdeowBtTa0snh7rSOOJgm nGh97IeE7J3GyiacbeelivQY+bCw0CTRjcyhxkm5JARY9ChwG+qzRox+N1mkCaJf7ZjC +JjAJl5/YXA+MqQOW/RAG7TkMeLuObIOIPkWhik0sva7e+513tjzTo0pDCTuG4FzMKne YqyDlgXkTNSMsx8tQIBfN27bW8S9IsdKUtKTOgd1lH4TSKy34QT9N3DW5KrIoGUa5plY VPRmZt8CT/WLXi92hNr3l/on8zP1b+K2DikmwVIohmICm/yADaqKiscPUeY79L5IbmIn lr7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pfu2EPjN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u27-v6si8648270pfk.82.2018.10.25.07.12.42; Thu, 25 Oct 2018 07:13:10 -0700 (PDT) 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=pfu2EPjN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728392AbeJYWop (ORCPT + 99 others); Thu, 25 Oct 2018 18:44:45 -0400 Received: from mail.kernel.org ([198.145.29.99]:53786 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728299AbeJYWoo (ORCPT ); Thu, 25 Oct 2018 18:44:44 -0400 Received: from sasha-vm.mshome.net (unknown [167.98.65.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A637620854; Thu, 25 Oct 2018 14:11:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1540476709; bh=gh/ygm9rslzbkik+aEhooF8MXglKfZwhbn+hwIYba3s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pfu2EPjNRjwD9jSpxdI+yOZejGWIMBX30q1u4d6xZ2DWq78ACj/6XsrLDT9vg9w7/ fF2tPLIABSs4t1+nh/4hI3Hca0l8Pt82qc257Ot2/Ld6XiiXJEG5XZ92eQd76eF/fg 4RMksERTekLKoCqFe9uKTuwhVr1GG0OQbImkb0nY= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "Martin K. Petersen" , Sasha Levin Subject: [PATCH AUTOSEL 4.14 39/46] scsi: sd: Remember that READ CAPACITY(16) succeeded Date: Thu, 25 Oct 2018 10:10:46 -0400 Message-Id: <20181025141053.213330-39-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181025141053.213330-1-sashal@kernel.org> References: <20181025141053.213330-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "Martin K. Petersen" [ Upstream commit 597d74005ba85e87c256cd732128ebf7faf54247 ] 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 Reviewed-by: Laurence Oberman Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/sd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 4a532318b211..b0dd8bdfdf98 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -2497,6 +2497,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; } } -- 2.17.1