aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@steeleye.com>2006-02-23 14:27:18 -0600
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-02-27 23:37:45 -0600
commitffedb4522571ac170f941678d138a31bc0884ab4 (patch)
tree996572da6cecf4295c730b13c959d5d19836a8c5 /include
parent1fa44ecad2b86475e038aed81b0bf333fa484f8b (diff)
[SCSI] fix scsi process problems and clean up the target reap issues
In order to use the new execute_in_process_context() API, you have to provide it with the work storage, which I do in SCSI in scsi_device and scsi_target, but which also means that we can no longer queue up the target reaps, so instead I moved the target to a state model which allows target_alloc to detect if we've received a dying target and wait for it to be gone. Hopefully, this should also solve the target namespace race. Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'include')
-rw-r--r--include/scsi/scsi.h2
-rw-r--r--include/scsi/scsi_device.h10
2 files changed, 10 insertions, 2 deletions
diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h
index 9c331258bc2..c60b8ff2f5e 100644
--- a/include/scsi/scsi.h
+++ b/include/scsi/scsi.h
@@ -433,6 +433,4 @@ struct scsi_lun {
/* Used to obtain the PCI location of a device */
#define SCSI_IOCTL_GET_PCI 0x5387
-int scsi_execute_in_process_context(void (*fn)(void *data), void *data);
-
#endif /* _SCSI_SCSI_H */
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 8d77da932d2..1ec17ee1281 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -4,6 +4,7 @@
#include <linux/device.h>
#include <linux/list.h>
#include <linux/spinlock.h>
+#include <linux/workqueue.h>
#include <asm/atomic.h>
struct request_queue;
@@ -137,6 +138,8 @@ struct scsi_device {
struct device sdev_gendev;
struct class_device sdev_classdev;
+ struct execute_work ew; /* used to get process context on put */
+
enum scsi_device_state sdev_state;
unsigned long sdev_data[0];
} __attribute__((aligned(sizeof(unsigned long))));
@@ -153,6 +156,11 @@ struct scsi_device {
#define scmd_printk(prefix, scmd, fmt, a...) \
dev_printk(prefix, &(scmd)->device->sdev_gendev, fmt, ##a)
+enum scsi_target_state {
+ STARGET_RUNNING = 1,
+ STARGET_DEL,
+};
+
/*
* scsi_target: representation of a scsi target, for now, this is only
* used for single_lun devices. If no one has active IO to the target,
@@ -172,6 +180,8 @@ struct scsi_target {
/* means no lun present */
char scsi_level;
+ struct execute_work ew;
+ enum scsi_target_state state;
void *hostdata; /* available to low-level driver */
unsigned long starget_data[0]; /* for the transport */
/* starget_data must be the last element!!!! */