public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 1/2] add transport scan callout to fix sysfs layout when scanning from userspace
@ 2005-05-21 21:37 Mike Christie
  2005-05-24 23:01 ` Patrick Mansfield
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Christie @ 2005-05-21 21:37 UTC (permalink / raw)
  To: open-iscsi, linux-scsi

When scanning hosts that implement FC rport support and
open-iscsi/linux-iscsi-5 hosts from userspace the sysfs
layout will end up placing the target's parent as the host
instead of some transport specific object. For FC the
target's parent should be the rport and for open-iscsi the
parent should be a session (that is if for open-iscsi our
using struct devices and our sysfs layout is correct).

The problem is due to the scsi host scan attribute calling
scsi_scan_host_selected, but the transports calling
scsi_scan_target. To further complicate matters iscsi does
not use a work queue for scanning since it initiates the
scanning from usersapce and it manages its channel and target
numbers from userspace. And, FC rport support is the opposite.

To fix this the inlined patch just adds a scan callout onto
the scsi_transport_template so scsi_sysfs can call it if set.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>

diff -aurp linux-2.6.12-rc4/drivers/scsi/scsi_sysfs.c linux-2.6.12-rc4.work/drivers/scsi/scsi_sysfs.c
--- linux-2.6.12-rc4/drivers/scsi/scsi_sysfs.c	2005-05-06 22:20:31.000000000 -0700
+++ linux-2.6.12-rc4.work/drivers/scsi/scsi_sysfs.c	2005-05-20 23:08:08.000000000 -0700
@@ -80,7 +80,11 @@ static int scsi_scan(struct Scsi_Host *s
 		return -EINVAL;
 	if (check_set(&lun, s3))
 		return -EINVAL;
-	res = scsi_scan_host_selected(shost, channel, id, lun, 1);
+
+	if (shost->transportt->scan)
+		res = shost->transportt->scan(shost, channel, id, lun, 1);
+	else
+		res = scsi_scan_host_selected(shost, channel, id, lun, 1);
 	return res;
 }
 
diff -aurp linux-2.6.12-rc4/include/scsi/scsi_transport.h linux-2.6.12-rc4.work/include/scsi/scsi_transport.h
--- linux-2.6.12-rc4/include/scsi/scsi_transport.h	2005-05-06 22:20:31.000000000 -0700
+++ linux-2.6.12-rc4.work/include/scsi/scsi_transport.h	2005-05-20 23:12:38.000000000 -0700
@@ -39,6 +39,12 @@ struct scsi_transport_template {
 	 * True if the transport wants to use a host-based work-queue
 	 */
 	unsigned int create_work_queue : 1;
+
+	/*
+	 * optional transport specific scanning function
+	 */
+	int (* scan)(struct Scsi_Host *, unsigned int, unsigned int,
+		     unsigned int, int);
 };
 
 #define transport_class_to_shost(tc) \



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-05-25  0:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-21 21:37 [PATCH RFC 1/2] add transport scan callout to fix sysfs layout when scanning from userspace Mike Christie
2005-05-24 23:01 ` Patrick Mansfield
2005-05-25  0:30   ` Patrick Mansfield
2005-05-25  0:41     ` Mike Christie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox