From owner-cvs-src@FreeBSD.ORG Wed Feb 28 08:58:18 2007 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 059E116A401; Wed, 28 Feb 2007 08:58:18 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (tim.des.no [194.63.250.121]) by mx1.freebsd.org (Postfix) with ESMTP id A946213C428; Wed, 28 Feb 2007 08:58:17 +0000 (UTC) (envelope-from des@des.no) Received: from tim.des.no (localhost [127.0.0.1]) by spam.des.no (Postfix) with ESMTP id 09667207E; Wed, 28 Feb 2007 09:58:13 +0100 (CET) X-Spam-Tests: AWL X-Spam-Learn: disabled X-Spam-Score: 0.0/3.0 X-Spam-Checker-Version: SpamAssassin 3.1.7 (2006-10-05) on tim.des.no Received: from dwp.des.no (des.no [80.203.243.180]) by tim.des.no (Postfix) with ESMTP id 7C2472049; Wed, 28 Feb 2007 09:58:12 +0100 (CET) Received: by dwp.des.no (Postfix, from userid 1001) id 5EA20B874; Wed, 28 Feb 2007 09:58:12 +0100 (CET) From: des@des.no (Dag-Erling =?iso-8859-1?Q?Sm=F8rgrav?=) To: Warner Losh References: <200702272233.l1RMXocb004983@repoman.freebsd.org> Date: Wed, 28 Feb 2007 09:58:12 +0100 In-Reply-To: <200702272233.l1RMXocb004983@repoman.freebsd.org> (Warner Losh's message of "Tue, 27 Feb 2007 22:33:50 +0000 (UTC)") Message-ID: <86d53ufyl7.fsf@dwp.des.no> User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.3 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/dev/usb umass.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Feb 2007 08:58:18 -0000 Warner Losh writes: > Log: > Some USB mass storage devices return the number of sectors in response > to a READ_CAPACITY request rather than the maximum sector (off by one > problem). This causes a huge cascade of errors as the geom tasting > code tries to read the last sector (which isn't really there in the > face of this error). automated tools that manipulate disk labels and > such also have issues. >=20=20=20 > Create a new quirk READ_CAPACITY_OFFBY1 and add a quirk for the > SanDISK ImageMate that I have that suffers from this problem (the > SDDR-31). It intercepts the READ_CAPACITY response and adjusts it > from number of sectors to max sector for devices with this quirk. >=20=20=20 > Reading the Linux source suggests that there are a host of > other devices with this issue, including iPods and some popular > cameras. I've not added quirks for them, since I don't have the > devices in front of me to test. How about the following dirty hack: if the appropriate kernel option / device hint / sysctl knob is frobbed, when a READ_CAPACITY request completes, try to read the last sector, and if that doesn't work, adjust the result and print a warning to the console? DES --=20 Dag-Erling Sm=F8rgrav - des@des.no