All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] scsi_set_host_offline (resend)
@ 2003-03-30 17:26 Oliver Neukum
  2003-04-09 20:30 ` Luben Tuikov
                   ` (4 more replies)
  0 siblings, 5 replies; 35+ messages in thread
From: Oliver Neukum @ 2003-03-30 17:26 UTC (permalink / raw)
  To: linux-hotplug


> The way to think about this, I think, is "what would we do if the user
> asked nicely before removing the device" (i.e. requested device ejection
> rather than forced it).  Then the above makes perfect sense because we
> have to start at the top and move down.  Since requested ejection is the
> model for things like hotplug PCI busses, I'm hoping someone else is
> thinking about this.

No this is exactly the way not to ever think about this.
You are not asked to remove a device, you are informed it's gone.
This is the case in all but sometimes one type of bus system in the
kernel. And that is the way information has to flow. Strictly
from the driver closest to the hardware up. And there must be no
undue delay and neither failure. Failure to handle a removal is a
contradiction in terms. This means that any call to user space must not be
waited for in the kernel and failure must not be deadly. Filesystems
must already be ready to deal with incorrectible errors. They are not
your problem.

	Regards
		Oliver



-------------------------------------------------------
This SF.net email is sponsored by:
The Definitive IT and Networking Event. Be There!
NetWorld+Interop Las Vegas 2003 -- Register today!
http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 35+ messages in thread
* [PATCH] scsi_set_host_offline (resend)
@ 2003-03-25 10:07 Mike Anderson
  2003-03-25 17:37 ` James Bottomley
  0 siblings, 1 reply; 35+ messages in thread
From: Mike Anderson @ 2003-03-25 10:07 UTC (permalink / raw)
  To: linux-scsi

This is a resend of a previous patch for the scsi_set_host_offline
interface.

-andmike
--
Michael Anderson
andmike@us.ibm.com

=====
name:		00_scsi_set_host_offline-2.diff
version:	2003-03-25.02:01:33-0800
against:	2.5.66

 scsi.c |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 scsi.h |    1 +
 2 files changed, 51 insertions(+)

=====
===== drivers/scsi/scsi.c 1.99 vs edited =====
--- 1.99/drivers/scsi/scsi.c	Mon Mar  3 10:48:16 2003
+++ edited/drivers/scsi/scsi.c	Tue Mar 25 01:45:00 2003
@@ -1295,6 +1295,37 @@
 }
 
 /**
+ * scsi_host_for_each_device - call function for each host child device
+ * @shost:	struct Scsi_Host to interate over.
+ * @data:	void pointer argumnet passed to called function.
+ * @fn:		function to call for each device.
+ *
+ **/
+static int scsi_host_for_each_device(struct Scsi_Host *shost,
+			 void * data, int (*fn)(struct scsi_device *, void *))
+{
+	struct list_head *lh;
+	struct scsi_device *sdev;
+	unsigned long flags;
+	int error = 0;
+
+	spin_lock_irqsave(shost->host_lock, flags);
+	for (lh = shost->my_devices.next; 
+	      (!error) && (lh != &shost->my_devices);) {
+		sdev = list_entry(lh, struct scsi_device, siblings);
+		scsi_device_get(sdev);
+		spin_unlock_irqrestore(shost->host_lock, flags);
+		error = fn(sdev, data);
+		spin_lock_irqsave(shost->host_lock, flags);
+		lh = lh->next;
+		scsi_device_put(sdev);
+	}
+	spin_unlock_irqrestore(shost->host_lock, flags);
+
+	return error;
+}
+
+/**
  * scsi_set_device_offline - set scsi_device offline
  * @sdev:	pointer to struct scsi_device to offline. 
  *
@@ -1333,6 +1364,25 @@
 	} else {
 		/* FIXME: Send online state change hotplug event */
 	}
+}
+
+/**
+ * scsi_set_device_offline - wrapper.
+ **/
+static int __scsi_set_device_offline(struct scsi_device *sdev, void *data)
+{
+	scsi_set_device_offline(sdev);
+	return 0;
+}
+
+/**
+ * scsi_set_host_offline - set all scsi_devices on a host offline
+ * @shost:	pointer to struct Scsi_Host.
+ *
+ **/
+void scsi_set_host_offline(struct Scsi_Host *shost)
+{
+	scsi_host_for_each_device(shost, NULL, __scsi_set_device_offline);
 }
 
 /*
===== drivers/scsi/scsi.h 1.67 vs edited =====
--- 1.67/drivers/scsi/scsi.h	Fri Mar 14 16:35:26 2003
+++ edited/drivers/scsi/scsi.h	Mon Mar 24 11:24:59 2003
@@ -436,6 +436,7 @@
 extern void scsi_slave_detach(struct scsi_device *);
 extern int scsi_device_get(struct scsi_device *);
 extern void scsi_device_put(struct scsi_device *);
+extern void scsi_set_host_offline(struct Scsi_Host *);
 extern void scsi_set_device_offline(struct scsi_device *);
 extern void scsi_done(Scsi_Cmnd * SCpnt);
 extern void scsi_finish_command(Scsi_Cmnd *);


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

end of thread, other threads:[~2003-04-17 22:29 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-30 17:26 [PATCH] scsi_set_host_offline (resend) Oliver Neukum
2003-04-09 20:30 ` Luben Tuikov
2003-04-09 22:32 ` Oliver Neukum
2003-04-09 22:59 ` Luben Tuikov
2003-04-10  7:51 ` Oliver Neukum
2003-04-17 22:29 ` Luben Tuikov
  -- strict thread matches above, loose matches on Subject: below --
2003-03-25 10:07 Mike Anderson
2003-03-25 17:37 ` James Bottomley
2003-03-25 18:45   ` Mike Anderson
2003-03-25 19:02     ` James Bottomley
2003-03-25 21:04       ` Patrick Mochel
2003-03-25 23:29       ` Mike Anderson
2003-03-27 15:42         ` James Bottomley
2003-03-29  0:31           ` Patrick Mansfield
2003-03-29  1:32           ` Matthew Dharm
2003-03-29  6:30             ` Mike Anderson
2003-03-29 14:43             ` James Bottomley
2003-03-29 19:04               ` Mike Anderson
2003-03-29 19:24                 ` Oliver Neukum
2003-03-29 20:53               ` Matthew Dharm
2003-03-29 21:54                 ` James Bottomley
2003-03-29 22:15                   ` Matthew Dharm
2003-03-30 16:23                     ` James Bottomley
2003-03-30 17:26                       ` Oliver Neukum
2003-04-09 20:30                         ` Luben Tuikov
2003-04-09 22:32                           ` Oliver Neukum
2003-04-09 22:59                             ` Luben Tuikov
2003-04-10  7:51                               ` Oliver Neukum
2003-04-17 22:29                                 ` Luben Tuikov
2003-03-30 18:21                       ` Matthew Dharm
2003-04-09 20:53                         ` Luben Tuikov
2003-03-29 22:50                   ` Oliver Neukum
2003-04-01  2:48                     ` Mike Anderson
2003-04-02  7:42                       ` Matthew Dharm
2003-04-03  2:05                         ` Mike Anderson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.