From patchwork Wed Jan 11 15:23:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Stern X-Patchwork-Id: 9510449 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 1225C601E7 for ; Wed, 11 Jan 2017 15:24:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0328228612 for ; Wed, 11 Jan 2017 15:24:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EBD9528620; Wed, 11 Jan 2017 15:24:17 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 3B82D28612 for ; Wed, 11 Jan 2017 15:24:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030296AbdAKPYP (ORCPT ); Wed, 11 Jan 2017 10:24:15 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:57086 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S935779AbdAKPYO (ORCPT ); Wed, 11 Jan 2017 10:24:14 -0500 Received: (qmail 2814 invoked by uid 2102); 11 Jan 2017 10:23:29 -0500 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 11 Jan 2017 10:23:29 -0500 Date: Wed, 11 Jan 2017 10:23:29 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: James Bottomley cc: Dainius =?UTF-8?Q?Masili=C5=ABnas?= , Pali =?ISO-8859-1?Q?Roh=E1r?= , SCSI development list , USB list , Tom Yan Subject: Re: Advanced Format SAT devices show incorrect physical block size In-Reply-To: <1484086345.2518.9.camel@HansenPartnership.com> Message-ID: MIME-Version: 1.0 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 On Tue, 10 Jan 2017, James Bottomley wrote: > On Tue, 2017-01-10 at 16:00 -0500, Alan Stern wrote: > > In theory, I suppose we could change the kernel so that it would > > default to READ CAPACITY(16) for devices that report a SCSI level >= > > 3, or something along those lines. In general we hesitate to make > > changes of this sort, because they almost always end up breaking > > _some_ devices -- and if that happens then the change is reverted, > > with no exceptions. Linus has a very strict rule about not breaking > > working systems. > > You shouldn't have to change anything: it already does (otherwise how > else would we detect physical exponent for proper SCSI devices) see > sd.c:sd_try_rc16_first(). It always returns false for USB because you > set sdev->try_rc_10_first In fact, this approach probably won't work. See Bugzilla entries #43265 and #43391. The devices in those reports claimed to be ANSI level 4, but they failed anyway. If you guys want to try the quirk flag, you can apply the patch below. Then set the usb-storage module parameter quirks=vvvv:pppp:k where vvvv and pppp are the Vendor and Product ID codes for your device (as 4 hex digits). In the long run, however, this is not a viable approach. We'd be better off with an explicit blacklist. Alan Stern --- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: usb-4.x/drivers/usb/storage/usb.c =================================================================== --- usb-4.x.orig/drivers/usb/storage/usb.c +++ usb-4.x/drivers/usb/storage/usb.c @@ -498,7 +498,7 @@ void usb_stor_adjust_quirks(struct usb_d US_FL_INITIAL_READ10 | US_FL_WRITE_CACHE | US_FL_NO_ATA_1X | US_FL_NO_REPORT_OPCODES | US_FL_MAX_SECTORS_240 | US_FL_NO_REPORT_LUNS | - US_FL_ALWAYS_SYNC); + US_FL_ALWAYS_SYNC | US_FL_NEEDS_CAP16); p = quirks; while (*p) { @@ -551,6 +551,9 @@ void usb_stor_adjust_quirks(struct usb_d case 'j': f |= US_FL_NO_REPORT_LUNS; break; + case 'k': + f |= US_FL_NEEDS_CAP16; + break; case 'l': f |= US_FL_NOT_LOCKABLE; break;