public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Kurt Garloff <garloff@suse.de>
To: Christoph Hellwig <hch@infradead.org>
Cc: Linux SCSI list <linux-scsi@vger.kernel.org>,
	Patrick Mansfield <patmans@us.ibm.com>,
	James Bottomley <James.Bottomley@steeleye.com>,
	Andrew Morton <akpm@osdl.org>
Subject: Re: PATCH 4/5: scsi-scan-dont-att-pq-notcon
Date: Wed, 21 Apr 2004 18:16:05 +0200	[thread overview]
Message-ID: <20040421161605.GA643@tpkurt.garloff.de> (raw)
In-Reply-To: <20040421163336.A7382@infradead.org>

[-- Attachment #1: Type: text/plain, Size: 3159 bytes --]

On Wed, Apr 21, 2004 at 04:33:36PM +0100, Christoph Hellwig wrote:
> (also needs a respin of the sd.c part of the previous patch, btw - and while
> you're at it can you kill the date in the scsi_scan.c comment?  Everyone can
> see when it was applied in bk annotate or the web interface for it)

OTOH, there's so few to be changed that I can resend right away ;-)

garloff@suse.de

Bugfix

Don't mark devices with PQ = 1 (or 3) offline, as they can't be accessed
at all then any more, not even by sg.
Don't attach other upper level drivers if PQ != 0.
SPC3, 7.4.2.

diff -uNrp linux-2.6.5.replun/drivers/scsi/scsi_scan.c linux-2.6.5.nooffline/drivers/scsi/scsi_scan.c
--- linux-2.6.5.replun/drivers/scsi/scsi_scan.c	2004-04-21 14:26:31.000000000 +0200
+++ linux-2.6.5.nooffline/drivers/scsi/scsi_scan.c	2004-04-21 14:28:13.000000000 +0200
@@ -542,16 +542,10 @@ static int scsi_add_lun(struct scsi_devi
 	 * 011 the same. Stay compatible with previous code, and create a
 	 * Scsi_Device for a PQ of 1
 	 *
-	 * XXX Save the PQ field let the upper layers figure out if they
-	 * want to attach or not to this device, do not set online FALSE;
-	 * otherwise, offline devices still get an sd allocated, and they
-	 * use up an sd slot.
-	 */
-	if (((inq_result[0] >> 5) & 7) == 1) {
-		SCSI_LOG_SCAN_BUS(3, printk(KERN_INFO "scsi scan: peripheral"
-				" qualifier of 1, device offlined\n"));
-		sdev->online = FALSE;
-	}
+	 * Don't set the device offline here; rather let the upper
+	 * level drivers eval the PQ to decide whether they should
+	 * attach. So remove ((inq_result[0] >> 5) & 7) == 1 check.
+	 */ 
 
 	sdev->removable = (0x80 & inq_result[1]) >> 7;
 	sdev->lockable = sdev->removable;
diff -uNrp linux-2.6.5.replun/include/scsi/scsi.h linux-2.6.5.nooffline/include/scsi/scsi.h
--- linux-2.6.5.replun/include/scsi/scsi.h	2004-04-20 21:51:40.000000000 +0200
+++ linux-2.6.5.nooffline/include/scsi/scsi.h	2004-04-21 14:28:13.000000000 +0200
@@ -365,6 +365,13 @@ struct scsi_lun {
 #define SCSI_2          3
 #define SCSI_3          4
 
+/*
+ * INQ PERIPHERAL QUALIFIERS
+ */
+#define SCSI_INQ_PQ_CON         0x00
+#define SCSI_INQ_PQ_NOT_CON     0x01
+#define SCSI_INQ_PQ_NOT_CAP     0x03
+
 
 /*
  * Here are some scsi specific ioctl commands which are sometimes useful.
diff -uNrp linux-2.6.5.attach/drivers/scsi/scsi_sysfs.c linux-2.6.5.noattach/drivers/scsi/scsi_sysfs.c
--- linux-2.6.5.attach/drivers/scsi/scsi_sysfs.c	2004-04-04 05:36:26.000000000 +0200
+++ linux-2.6.5.noattach/drivers/scsi/scsi_sysfs.c	2004-04-21 17:22:22.000000000 +0200
@@ -155,7 +155,9 @@ struct class sdev_class = {
 /* all probing is done in the individual ->probe routines */
 static int scsi_bus_match(struct device *dev, struct device_driver *gendrv)
 {
-	return 1;
+	struct scsi_device *sdp = to_scsi_device(dev);
+	int pq = (sdp->inquiry[0] >> 5) & 7;
+	return (pq == SCSI_INQ_PQ_CON)? 1: 0;
 }
 
 struct bus_type scsi_bus_type = {

Regards,
-- 
Kurt Garloff  <garloff@suse.de>                            Cologne, DE 
SUSE LINUX AG, Nuernberg, DE                          SUSE Labs (Head)

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2004-04-21 16:16 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-18 18:57 Patches for SCSI scanning Kurt Garloff
2004-04-18 23:16 ` James Bottomley
2004-04-20 11:54   ` Kurt Garloff
2004-04-20 12:04     ` Christoph Hellwig
2004-04-20 13:02       ` Kurt Garloff
2004-04-20 14:38     ` James Bottomley
2004-04-20 16:03       ` Kurt Garloff
2004-04-20 16:08         ` James Bottomley
2004-04-21 13:48           ` Kurt Garloff
2004-04-21 15:36             ` James Bottomley
2004-04-21 13:45         ` Kurt Garloff
2004-04-21 14:10           ` PATCH 1/5: scsi-scan-deprecate-forcelun Kurt Garloff
2004-04-21 14:12           ` PATCH 2/5: scsi-scan-blist_replun Kurt Garloff
2004-04-21 15:14             ` Christoph Hellwig
2004-04-21 15:30               ` Kurt Garloff
2004-04-21 16:03               ` Kurt Garloff
2004-04-21 14:13           ` PATCH 3/5: scsi-scan-no-offl-pq-notcon Kurt Garloff
2004-04-21 14:14           ` PATCH 4/5: scsi-scan-dont-att-pq-notcon Kurt Garloff
2004-04-21 15:02             ` Christoph Hellwig
2004-04-21 15:24               ` Kurt Garloff
2004-04-21 15:33                 ` Mike Anderson
2004-04-21 15:33                 ` Christoph Hellwig
2004-04-21 16:08                   ` Kurt Garloff
2004-04-21 16:18                     ` James Bottomley
2004-04-21 16:55                       ` Patrick Mansfield
2004-04-21 22:51                         ` Kurt Garloff
2004-04-22 20:39                           ` Patrick Mansfield
2004-04-22 20:45                             ` James Bottomley
2004-04-21 16:58                       ` Kurt Garloff
2004-04-21 16:16                   ` Kurt Garloff [this message]
2004-04-21 15:40             ` James Bottomley
2004-04-21 14:14           ` PATCH 5/5: scsi-scan-inq-timeout Kurt Garloff
2004-04-21 20:24             ` Patrick Mansfield
2004-04-21 22:48               ` Kurt Garloff
2004-04-21 23:49                 ` Patrick Mansfield
2004-04-20 16:26       ` Patches for SCSI scanning Patrick Mansfield
2004-04-20 16:42         ` Kurt Garloff
2004-04-20 17:44           ` Patrick Mansfield
2004-04-21 13:52             ` Kurt Garloff
2004-04-20 10:24 ` Fabien Salvi

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=20040421161605.GA643@tpkurt.garloff.de \
    --to=garloff@suse.de \
    --cc=James.Bottomley@steeleye.com \
    --cc=akpm@osdl.org \
    --cc=hch@infradead.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=patmans@us.ibm.com \
    /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