From 1c97a12a29b49ad4432927eac076fd5e3dedece6 Mon Sep 17 00:00:00 2001 From: Andrew Vasquez Date: Thu, 21 Apr 2005 16:13:36 -0400 Subject: [SCSI] qla2xxx: remove a transport #include Make transport-functions structure non-static. Replace #include of scsi_transport.h with a forward declaration. Signed-off-by: Andrew Vasquez Signed-off-by: James Bottomley --- drivers/scsi/qla2xxx/qla_attr.c | 8 +------- drivers/scsi/qla2xxx/qla_gbl.h | 4 ++-- drivers/scsi/qla2xxx/qla_os.c | 3 ++- 3 files changed, 5 insertions(+), 10 deletions(-) (limited to 'drivers') diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c index 2240a0cde58..9bc1f153f7e 100644 --- a/drivers/scsi/qla2xxx/qla_attr.c +++ b/drivers/scsi/qla2xxx/qla_attr.c @@ -300,7 +300,7 @@ qla2x00_set_rport_loss_tmo(struct fc_rport *rport, uint32_t timeout) rport->dev_loss_tmo = ha->port_down_retry_count + 5; } -static struct fc_function_template qla2xxx_transport_functions = { +struct fc_function_template qla2xxx_transport_functions = { .show_host_node_name = 1, .show_host_port_name = 1, @@ -322,12 +322,6 @@ static struct fc_function_template qla2xxx_transport_functions = { }; -struct scsi_transport_template * -qla2x00_alloc_transport_tmpl(void) -{ - return (fc_attach_transport(&qla2xxx_transport_functions)); -} - void qla2x00_init_host_attr(scsi_qla_host_t *ha) { diff --git a/drivers/scsi/qla2xxx/qla_gbl.h b/drivers/scsi/qla2xxx/qla_gbl.h index e4bfe4d5bbe..2efec6c24d6 100644 --- a/drivers/scsi/qla2xxx/qla_gbl.h +++ b/drivers/scsi/qla2xxx/qla_gbl.h @@ -24,7 +24,6 @@ #define __QLA_GBL_H #include -#include extern void qla2x00_remove_one(struct pci_dev *); extern int qla2x00_probe_one(struct pci_dev *, struct qla_board_info *); @@ -248,9 +247,10 @@ extern void qla2x00_cancel_io_descriptors(scsi_qla_host_t *); /* * Global Function Prototypes in qla_attr.c source file. */ +struct fc_function_template; +extern struct fc_function_template qla2xxx_transport_functions; extern void qla2x00_alloc_sysfs_attr(scsi_qla_host_t *); extern void qla2x00_free_sysfs_attr(scsi_qla_host_t *); -extern struct scsi_transport_template *qla2x00_alloc_transport_tmpl(void); extern void qla2x00_init_host_attr(scsi_qla_host_t *); extern void qla2x00_alloc_sysfs_attr(scsi_qla_host_t *); extern void qla2x00_free_sysfs_attr(scsi_qla_host_t *); diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 84db911318c..579448222d6 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -2350,7 +2350,8 @@ qla2x00_module_init(void) #if DEBUG_QLA2100 strcat(qla2x00_version_str, "-debug"); #endif - qla2xxx_transport_template = qla2x00_alloc_transport_tmpl(); + qla2xxx_transport_template = + fc_attach_transport(&qla2xxx_transport_functions); if (!qla2xxx_transport_template) return -ENODEV; -- cgit v1.2.3 From 0bdcd78ea2342ad1a9c79cac99eefcfd0b3f1c2b Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Thu, 21 Apr 2005 16:13:39 -0400 Subject: [SCSI] aic7xxx: remove inquiry sniffing leftovers Signed-off-by: James Bottomley --- drivers/scsi/aic7xxx/aic7xxx_osm.c | 2 -- drivers/scsi/aic7xxx/aic7xxx_osm.h | 6 ------ 2 files changed, 8 deletions(-) (limited to 'drivers') diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.c b/drivers/scsi/aic7xxx/aic7xxx_osm.c index e60f9338e44..d978e4a3e97 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.c +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.c @@ -2335,8 +2335,6 @@ ahc_linux_free_target(struct ahc_softc *ahc, struct ahc_linux_target *targ) AHC_TRANS_GOAL, /*paused*/FALSE); ahc_update_neg_request(ahc, &devinfo, tstate, tinfo, AHC_NEG_ALWAYS); ahc->platform_data->targets[target_offset] = NULL; - if (targ->inq_data != NULL) - free(targ->inq_data, M_DEVBUF); free(targ, M_DEVBUF); } diff --git a/drivers/scsi/aic7xxx/aic7xxx_osm.h b/drivers/scsi/aic7xxx/aic7xxx_osm.h index c401537067b..ed9027bd8a4 100644 --- a/drivers/scsi/aic7xxx/aic7xxx_osm.h +++ b/drivers/scsi/aic7xxx/aic7xxx_osm.h @@ -423,10 +423,6 @@ struct ahc_linux_device { struct ahc_linux_target *target; }; -typedef enum { - AHC_INQ_VALID = 0x02, -} ahc_linux_targ_flags; - struct ahc_linux_target { struct ahc_linux_device *devices[AHC_NUM_LUNS]; int channel; @@ -434,8 +430,6 @@ struct ahc_linux_target { int refcount; struct ahc_transinfo last_tinfo; struct ahc_softc *ahc; - ahc_linux_targ_flags flags; - struct scsi_inquiry_data *inq_data; }; /********************* Definitions Required by the Core ***********************/ -- cgit v1.2.3 From 3a73e8c7715cdf53c24b602bfca15ec54d7c989b Mon Sep 17 00:00:00 2001 From: Nate Dailey Date: Thu, 21 Apr 2005 16:14:05 -0400 Subject: [SCSI] drivers/scsi/sr_ioctl.c: check for failed allocation I noticed a case in sr_ioctl.c's sr_get_mcn where a buffer is allocated, but the pointer isn't checked for null. Signed-off-by: Nate Dailey Signed-off-by: James Bottomley --- drivers/scsi/sr_ioctl.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'drivers') diff --git a/drivers/scsi/sr_ioctl.c b/drivers/scsi/sr_ioctl.c index 3471be05779..82d68fdb154 100644 --- a/drivers/scsi/sr_ioctl.c +++ b/drivers/scsi/sr_ioctl.c @@ -281,6 +281,9 @@ int sr_get_mcn(struct cdrom_device_info *cdi, struct cdrom_mcn *mcn) char *buffer = kmalloc(32, GFP_KERNEL | SR_GFP_DMA(cd)); int result; + if (!buffer) + return -ENOMEM; + memset(&cgc, 0, sizeof(struct packet_command)); cgc.cmd[0] = GPCMD_READ_SUBCHANNEL; cgc.cmd[2] = 0x40; /* I do want the subchannel info */ -- cgit v1.2.3 From bd6ae2f6d61da0f90c6b66e9a4ab6c53ef8c159a Mon Sep 17 00:00:00 2001 From: Andreas Herrmann Date: Thu, 21 Apr 2005 16:14:31 -0400 Subject: [SCSI] zfcp: fix compile error Signed-off-by: Andreas Herrmann Signed-off-by: James Bottomley --- drivers/s390/scsi/zfcp_aux.c | 2 +- drivers/s390/scsi/zfcp_def.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c index 1f9aeb4accc..68d151aaa47 100644 --- a/drivers/s390/scsi/zfcp_aux.c +++ b/drivers/s390/scsi/zfcp_aux.c @@ -52,7 +52,7 @@ static inline int zfcp_sg_list_copy_from_user(struct zfcp_sg_list *, static inline int zfcp_sg_list_copy_to_user(void __user *, struct zfcp_sg_list *, size_t); -static int zfcp_cfdc_dev_ioctl(struct file *, unsigned int, unsigned long); +static long zfcp_cfdc_dev_ioctl(struct file *, unsigned int, unsigned long); #define ZFCP_CFDC_IOC_MAGIC 0xDD #define ZFCP_CFDC_IOC \ diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h index 0afa1c4696c..c5daf372f85 100644 --- a/drivers/s390/scsi/zfcp_def.h +++ b/drivers/s390/scsi/zfcp_def.h @@ -61,7 +61,6 @@ #include #include #include -#include /************************ DEBUG FLAGS *****************************************/ -- cgit v1.2.3 From 036d618434516103adb4d36db28a57968d2f2e7b Mon Sep 17 00:00:00 2001 From: Mark Haverkamp Date: Tue, 26 Apr 2005 22:54:58 -0700 Subject: [SCSI] aacraid: Fix adapter open error This fixes an error on the device open code that allows a non-existent device to be opened causing later panic problems. Signed-off-by: Mark Haverkamp Signed-off-by: James Bottomley --- drivers/scsi/aacraid/linit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index c9b82687ba1..242fa77513f 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c @@ -450,7 +450,7 @@ static int aac_cfg_open(struct inode *inode, struct file *file) } } - return 0; + return err; } /** -- cgit v1.2.3 From 69b528936b702d4c13ffa0d14215a029dc754e50 Mon Sep 17 00:00:00 2001 From: Mike Christie Date: Sun, 1 May 2005 14:47:15 -0500 Subject: [SCSI] call correct scsi_done function in scsi_dispatch_cmd scsi_dispatch_cmd currently calls scsi_done when the device is in the SDEV_DEL state, but at this point the command has not had a timer added to it (this is done a couple lines down) so scsi_done just returns and the command is lost. The attached patch made against 2.6.12-rc3 calls __scsi_done in this case so the comamnd will be returned upwards. Signed-off-by: Mike Christie Signed-off-by: James Bottomley --- drivers/scsi/scsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index 05d2bd075fd..184bcaeaf81 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c @@ -542,7 +542,7 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd) * that the device is no longer present */ cmd->result = DID_NO_CONNECT << 16; atomic_inc(&cmd->device->iorequest_cnt); - scsi_done(cmd); + __scsi_done(cmd); /* return 0 (because the command has been processed) */ goto out; } -- cgit v1.2.3 From 949bf797595fc99d4cadf9a294fe6fd32a4474e6 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Sun, 1 May 2005 18:58:15 -0500 Subject: [SCSI] fix command retries in spi_transport class The premise is that domain validation is likely to trigger errors which it wants to know about, so the only time it should be retrying them is when it gets a unit attention (likely as the result of a previous bus or device reset). Ironically, the previous coding retried three times in all cases except those of unit attention. The attached fixes this to do the right thing. Signed-off-by: James Bottomley --- drivers/scsi/scsi_transport_spi.c | 49 +++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 15 deletions(-) (limited to 'drivers') diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c index 303d7656f71..28966d05435 100644 --- a/drivers/scsi/scsi_transport_spi.c +++ b/drivers/scsi/scsi_transport_spi.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include "scsi_priv.h" @@ -41,6 +42,11 @@ #define SPI_MAX_ECHO_BUFFER_SIZE 4096 +#define DV_LOOPS 3 +#define DV_TIMEOUT (10*HZ) +#define DV_RETRIES 3 /* should only need at most + * two cc/ua clears */ + /* Private data accessors (keep these out of the header file) */ #define spi_dv_pending(x) (((struct spi_transport_attrs *)&(x)->starget_data)->dv_pending) #define spi_dv_sem(x) (((struct spi_transport_attrs *)&(x)->starget_data)->dv_sem) @@ -100,6 +106,29 @@ static int sprint_frac(char *dest, int value, int denom) return result; } +/* Modification of scsi_wait_req that will clear UNIT ATTENTION conditions + * resulting from (likely) bus and device resets */ +static void spi_wait_req(struct scsi_request *sreq, const void *cmd, + void *buffer, unsigned bufflen) +{ + int i; + + for(i = 0; i < DV_RETRIES; i++) { + sreq->sr_request->flags |= REQ_FAILFAST; + + scsi_wait_req(sreq, cmd, buffer, bufflen, + DV_TIMEOUT, /* retries */ 1); + if (sreq->sr_result & DRIVER_SENSE) { + struct scsi_sense_hdr sshdr; + + if (scsi_request_normalize_sense(sreq, &sshdr) + && sshdr.sense_key == UNIT_ATTENTION) + continue; + } + break; + } +} + static struct { enum spi_signal_type value; char *name; @@ -378,11 +407,6 @@ static CLASS_DEVICE_ATTR(signalling, S_IRUGO | S_IWUSR, if(i->f->set_##x) \ i->f->set_##x(sdev->sdev_target, y) -#define DV_LOOPS 3 -#define DV_TIMEOUT (10*HZ) -#define DV_RETRIES 3 /* should only need at most - * two cc/ua clears */ - enum spi_compare_returns { SPI_COMPARE_SUCCESS, SPI_COMPARE_FAILURE, @@ -446,8 +470,7 @@ spi_dv_device_echo_buffer(struct scsi_request *sreq, u8 *buffer, for (r = 0; r < retries; r++) { sreq->sr_cmd_len = 0; /* wait_req to fill in */ sreq->sr_data_direction = DMA_TO_DEVICE; - scsi_wait_req(sreq, spi_write_buffer, buffer, len, - DV_TIMEOUT, DV_RETRIES); + spi_wait_req(sreq, spi_write_buffer, buffer, len); if(sreq->sr_result || !scsi_device_online(sdev)) { struct scsi_sense_hdr sshdr; @@ -471,8 +494,7 @@ spi_dv_device_echo_buffer(struct scsi_request *sreq, u8 *buffer, memset(ptr, 0, len); sreq->sr_cmd_len = 0; /* wait_req to fill in */ sreq->sr_data_direction = DMA_FROM_DEVICE; - scsi_wait_req(sreq, spi_read_buffer, ptr, len, - DV_TIMEOUT, DV_RETRIES); + spi_wait_req(sreq, spi_read_buffer, ptr, len); scsi_device_set_state(sdev, SDEV_QUIESCE); if (memcmp(buffer, ptr, len) != 0) @@ -500,8 +522,7 @@ spi_dv_device_compare_inquiry(struct scsi_request *sreq, u8 *buffer, memset(ptr, 0, len); - scsi_wait_req(sreq, spi_inquiry, ptr, len, - DV_TIMEOUT, DV_RETRIES); + spi_wait_req(sreq, spi_inquiry, ptr, len); if(sreq->sr_result || !scsi_device_online(sdev)) { scsi_device_set_state(sdev, SDEV_QUIESCE); @@ -593,8 +614,7 @@ spi_dv_device_get_echo_buffer(struct scsi_request *sreq, u8 *buffer) * (reservation conflict, device not ready, etc) just * skip the write tests */ for (l = 0; ; l++) { - scsi_wait_req(sreq, spi_test_unit_ready, NULL, 0, - DV_TIMEOUT, DV_RETRIES); + spi_wait_req(sreq, spi_test_unit_ready, NULL, 0); if(sreq->sr_result) { if(l >= 3) @@ -608,8 +628,7 @@ spi_dv_device_get_echo_buffer(struct scsi_request *sreq, u8 *buffer) sreq->sr_cmd_len = 0; sreq->sr_data_direction = DMA_FROM_DEVICE; - scsi_wait_req(sreq, spi_read_buffer_descriptor, buffer, 4, - DV_TIMEOUT, DV_RETRIES); + spi_wait_req(sreq, spi_read_buffer_descriptor, buffer, 4); if (sreq->sr_result) /* Device has no echo buffer */ -- cgit v1.2.3 From e4862fedbc37a2c242824b100101f8e6e8488748 Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Fri, 6 May 2005 13:14:48 -0500 Subject: [SCSI] correct the sym2 period setting routines There's a slight bug in the routines in that if the period requires dt, then the routine will unconditionally set it. DT may only be set if Wide is also set, so this turns back on the wide bit. For domain validation to work correctly, we need to observe the wide bit absolutely. Acked by: Matthew Wilcox Signed-off-by: James Bottomley --- drivers/scsi/sym53c8xx_2/sym_glue.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c index 5ff83d214f1..5b07c6ec3ec 100644 --- a/drivers/scsi/sym53c8xx_2/sym_glue.c +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c @@ -2038,8 +2038,9 @@ static void sym2_set_period(struct scsi_target *starget, int period) struct sym_hcb *np = sym_get_hcb(shost); struct sym_tcb *tp = &np->target[starget->id]; - /* have to have DT for these transfers */ - if (period <= np->minsync) + /* have to have DT for these transfers, but DT will also + * set width, so check that this is allowed */ + if (period <= np->minsync && spi_width(starget)) tp->tgoal.dt = 1; tp->tgoal.period = period; -- cgit v1.2.3