mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: Tarkan Erimer <tarkan.erimer@turknet.net.tr>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
	linux-kernel@vger.kernel.org, linux-scsi@vger.kernel.org,
	Matthew Wilcox <matthew@wil.cx>
Subject: Re: [BISECTED] Re: [BUG] Linux-2.6.31-rc1 Fails To Recognize Some USB Disks
Date: Sun, 26 Jul 2009 21:28:15 -0400	[thread overview]
Message-ID: <yq1hbwykj80.fsf@sermon.lab.mkp.net> (raw)
In-Reply-To: <4A69D093.8020108@turknet.net.tr> (Tarkan Erimer's message of "Fri, 24 Jul 2009 18:17:39 +0300")

>>>>> "Tarkan" == Tarkan Erimer <tarkan.erimer@turknet.net.tr> writes:

Tarkan> root@tarkane:~# sg_inq -e /dev/sdb
Tarkan> VPD INQUIRY: extended INQUIRY data page
Tarkan> inquiry: transport: Host_status=0x05 [DID_ABORT]
Tarkan> Driver_status=0x00 [DRIVER_OK, SUGGEST_OK]
Tarkan>     inquiry: failed, res=-1

*sigh*


sd: Avoid sending extended inquiry to legacy/broken devices

Our existing check for VPD page validity does not handle devices that
refuse to respond to INQUIRY with the EVPD bit set.

Restrict extended inquiry to devices reporting SBC2/SPC3 or higher.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

---

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 5616cd7..9b703fd 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -1840,6 +1840,13 @@ static void sd_read_block_characteristics(struct scsi_disk *sdkp)
 	kfree(buffer);
 }
 
+static int sd_try_extended_inquiry(struct scsi_device *sdp)
+{
+	if (sdp->scsi_level > SCSI_SPC_2)
+		return 1;
+	return 0;
+}
+
 /**
  *	sd_revalidate_disk - called the first time a new disk is seen,
  *	performs disk spin up, read_capacity, etc.
@@ -1877,8 +1884,12 @@ static int sd_revalidate_disk(struct gendisk *disk)
 	 */
 	if (sdkp->media_present) {
 		sd_read_capacity(sdkp, buffer);
-		sd_read_block_limits(sdkp);
-		sd_read_block_characteristics(sdkp);
+
+		if (sd_try_extended_inquiry(sdp)) {
+			sd_read_block_limits(sdkp);
+			sd_read_block_characteristics(sdkp);
+		}
+
 		sd_read_write_protect_flag(sdkp, buffer);
 		sd_read_cache_type(sdkp, buffer);
 		sd_read_app_tag_own(sdkp, buffer);

  reply	other threads:[~2009-07-27  1:28 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-26  7:03 Tarkan Erimer
2009-06-29  3:21 ` Martin K. Petersen
2009-06-29  8:17   ` Tarkan Erimer
2009-06-29 14:30     ` Martin K. Petersen
2009-07-15  7:46       ` Tarkan Erimer
2009-07-20  2:25         ` Martin K. Petersen
2009-07-21  8:08           ` Tarkan Erimer
2009-07-24 10:55       ` [BISECTED] " Tarkan Erimer
2009-07-24 11:44         ` Tarkan Erimer
2009-07-24 14:02         ` Martin K. Petersen
2009-07-24 15:17           ` Tarkan Erimer
2009-07-27  1:28             ` Martin K. Petersen [this message]
2009-07-27  2:06               ` Matthew Wilcox
2009-07-27  2:43                 ` Martin K. Petersen
2009-07-27  8:27                   ` Boaz Harrosh
2009-07-27 14:29                     ` Martin K. Petersen
2009-07-27 14:50                       ` Matthew Wilcox
2009-07-27 15:10                         ` Martin K. Petersen
2009-07-27 14:51                       ` Boaz Harrosh
2009-07-27 15:19                         ` Martin K. Petersen
2009-07-27 15:40                           ` Boaz Harrosh
2009-07-27 15:47                             ` Boaz Harrosh
2009-07-27 15:55                             ` Martin K. Petersen
2009-07-27  7:31               ` Tarkan Erimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yq1hbwykj80.fsf@sermon.lab.mkp.net \
    --to=martin.petersen@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=tarkan.erimer@turknet.net.tr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®