]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/patches/suse-2.6.27.31/patches.fixes/scsi-remove-scmd-timeout
Move xen patchset to new version's subdir.
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.fixes / scsi-remove-scmd-timeout
diff --git a/src/patches/suse-2.6.27.31/patches.fixes/scsi-remove-scmd-timeout b/src/patches/suse-2.6.27.31/patches.fixes/scsi-remove-scmd-timeout
new file mode 100644 (file)
index 0000000..989fb17
--- /dev/null
@@ -0,0 +1,285 @@
+From: James Bottomley <James.Bottomley@HansenPartnership.com>
+Subject: Fix block timeout residue problems
+Date: Fri Dec 5 08:47:58 2008 +0100
+References: bnc#447249,bnc#441335
+
+It looks like there was only a partial conversion of the SCSI layer to
+the block timeout.  The missing piece was killing timeout in struct
+scsi_device and leaving it with a zero value.  This has already
+resulted in a regression:
+
+http://bugzilla.kernel.org/show_bug.cgi?id=12120
+
+But on closer inspection, there were lots of other dangling driver
+uses of the timeout value which would likewise have introduced hard to
+trace regressions.
+
+This patch series eliminates the timeout variable from struct
+scsi_device and makes everything uniformly use the block timeout.  Any
+wrong use of the scsi device timeout will now result in a compile
+failure.
+
+Signed-off-by: James Bottomley <james.bottomley@hansenpartnership.com>
+Signed-off-by: Hannes Reinecke <hare@suse.de>
+
+---
+ drivers/scsi/aacraid/linit.c         |    4 +-
+ drivers/scsi/ibmvscsi/ibmvscsi.c     |    2 -
+ drivers/scsi/megaraid/megaraid_sas.c |    3 +-
+ drivers/scsi/scsi_error.c            |    2 -
+ drivers/scsi/st.c                    |   47 ++++++++++++++++++++---------------
+ drivers/scsi/stex.c                  |    2 -
+ include/scsi/scsi_device.h           |    2 -
+ 7 files changed, 35 insertions(+), 27 deletions(-)
+
+--- a/drivers/scsi/aacraid/linit.c
++++ b/drivers/scsi/aacraid/linit.c
+@@ -427,8 +427,8 @@ static int aac_slave_configure(struct sc
+                * Firmware has an individual device recovery time typically
+                * of 35 seconds, give us a margin.
+                */
+-              if (sdev->timeout < (45 * HZ))
+-                      sdev->timeout = 45 * HZ;
++              if (sdev->request_queue->rq_timeout < (45 * HZ))
++                      blk_queue_rq_timeout(sdev->request_queue, 45*HZ);
+               for (cid = 0; cid < aac->maximum_num_containers; ++cid)
+                       if (aac->fsa_dev[cid].valid)
+                               ++num_lsu;
+--- a/drivers/scsi/ibmvscsi/ibmvscsi.c
++++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
+@@ -1442,7 +1442,7 @@ static int ibmvscsi_slave_configure(stru
+       spin_lock_irqsave(shost->host_lock, lock_flags);
+       if (sdev->type == TYPE_DISK) {
+               sdev->allow_restart = 1;
+-              sdev->timeout = 60 * HZ;
++              blk_queue_rq_timeout(sdev->request_queue, 60 * HZ);
+       }
+       scsi_adjust_queue_depth(sdev, 0, shost->cmd_per_lun);
+       spin_unlock_irqrestore(shost->host_lock, lock_flags);
+--- a/drivers/scsi/megaraid/megaraid_sas.c
++++ b/drivers/scsi/megaraid/megaraid_sas.c
+@@ -1016,7 +1016,8 @@ static int megasas_slave_configure(struc
+        * The RAID firmware may require extended timeouts.
+        */
+       if (sdev->channel >= MEGASAS_MAX_PD_CHANNELS)
+-              sdev->timeout = MEGASAS_DEFAULT_CMD_TIMEOUT * HZ;
++              blk_queue_rq_timeout(sdev->request_queue,
++                                   MEGASAS_DEFAULT_CMD_TIMEOUT * HZ);
+       return 0;
+ }
+--- a/drivers/scsi/scsi_error.c
++++ b/drivers/scsi/scsi_error.c
+@@ -1013,7 +1013,7 @@ static int scsi_eh_try_stu(struct scsi_c
+               for (i = 0; rtn == NEEDS_RETRY && i < 2; i++)
+                       rtn = scsi_send_eh_cmnd(scmd, stu_command, 6,
+-                                              scmd->device->timeout, 0);
++                                              scmd->device->request_queue->rq_timeout, 0);
+               if (rtn == SUCCESS)
+                       return 0;
+--- a/drivers/scsi/st.c
++++ b/drivers/scsi/st.c
+@@ -613,7 +613,8 @@ static int cross_eof(struct scsi_tape * 
+                  tape_name(STp), forward ? "forward" : "backward"));
+       SRpnt = st_do_scsi(NULL, STp, cmd, 0, DMA_NONE,
+-                         STp->device->timeout, MAX_RETRIES, 1);
++                         STp->device->request_queue->rq_timeout,
++                         MAX_RETRIES, 1);
+       if (!SRpnt)
+               return (STp->buffer)->syscall_result;
+@@ -657,7 +658,8 @@ static int st_flush_write_buffer(struct 
+               cmd[4] = blks;
+               SRpnt = st_do_scsi(NULL, STp, cmd, transfer, DMA_TO_DEVICE,
+-                                 STp->device->timeout, MAX_WRITE_RETRIES, 1);
++                                 STp->device->request_queue->rq_timeout,
++                                 MAX_WRITE_RETRIES, 1);
+               if (!SRpnt)
+                       return (STp->buffer)->syscall_result;
+@@ -987,7 +989,8 @@ static int check_tape(struct scsi_tape *
+               cmd[0] = READ_BLOCK_LIMITS;
+               SRpnt = st_do_scsi(SRpnt, STp, cmd, 6, DMA_FROM_DEVICE,
+-                                 STp->device->timeout, MAX_READY_RETRIES, 1);
++                                 STp->device->request_queue->rq_timeout,
++                                 MAX_READY_RETRIES, 1);
+               if (!SRpnt) {
+                       retval = (STp->buffer)->syscall_result;
+                       goto err_out;
+@@ -1014,7 +1017,8 @@ static int check_tape(struct scsi_tape *
+       cmd[4] = 12;
+       SRpnt = st_do_scsi(SRpnt, STp, cmd, 12, DMA_FROM_DEVICE,
+-                      STp->device->timeout, MAX_READY_RETRIES, 1);
++                         STp->device->request_queue->rq_timeout,
++                         MAX_READY_RETRIES, 1);
+       if (!SRpnt) {
+               retval = (STp->buffer)->syscall_result;
+               goto err_out;
+@@ -1247,7 +1251,8 @@ static int st_flush(struct file *filp, f
+               cmd[4] = 1 + STp->two_fm;
+               SRpnt = st_do_scsi(NULL, STp, cmd, 0, DMA_NONE,
+-                                 STp->device->timeout, MAX_WRITE_RETRIES, 1);
++                                 STp->device->request_queue->rq_timeout,
++                                 MAX_WRITE_RETRIES, 1);
+               if (!SRpnt) {
+                       result = (STp->buffer)->syscall_result;
+                       goto out;
+@@ -1634,7 +1639,8 @@ st_write(struct file *filp, const char _
+               cmd[4] = blks;
+               SRpnt = st_do_scsi(SRpnt, STp, cmd, transfer, DMA_TO_DEVICE,
+-                                 STp->device->timeout, MAX_WRITE_RETRIES, !async_write);
++                                 STp->device->request_queue->rq_timeout,
++                                 MAX_WRITE_RETRIES, !async_write);
+               if (!SRpnt) {
+                       retval = STbp->syscall_result;
+                       goto out;
+@@ -1804,7 +1810,8 @@ static long read_tape(struct scsi_tape *
+       SRpnt = *aSRpnt;
+       SRpnt = st_do_scsi(SRpnt, STp, cmd, bytes, DMA_FROM_DEVICE,
+-                         STp->device->timeout, MAX_RETRIES, 1);
++                         STp->device->request_queue->rq_timeout,
++                         MAX_RETRIES, 1);
+       release_buffering(STp, 1);
+       *aSRpnt = SRpnt;
+       if (!SRpnt)
+@@ -2213,7 +2220,8 @@ static int st_set_options(struct scsi_ta
+                       DEBC( printk(KERN_INFO "%s: Long timeout set to %d seconds.\n", name,
+                              (value & ~MT_ST_SET_LONG_TIMEOUT)));
+               } else {
+-                      STp->device->timeout = value * HZ;
++                      blk_queue_rq_timeout(STp->device->request_queue,
++                                           value * HZ);
+                       DEBC( printk(KERN_INFO "%s: Normal timeout set to %d seconds.\n",
+                               name, value) );
+               }
+@@ -2321,7 +2329,7 @@ static int read_mode_page(struct scsi_ta
+       cmd[4] = 255;
+       SRpnt = st_do_scsi(SRpnt, STp, cmd, cmd[4], DMA_FROM_DEVICE,
+-                         STp->device->timeout, 0, 1);
++                         STp->device->request_queue->rq_timeout, 0, 1);
+       if (SRpnt == NULL)
+               return (STp->buffer)->syscall_result;
+@@ -2352,7 +2360,7 @@ static int write_mode_page(struct scsi_t
+       (STp->buffer)->b_data[pgo + MP_OFF_PAGE_NBR] &= MP_MSK_PAGE_NBR;
+       SRpnt = st_do_scsi(SRpnt, STp, cmd, cmd[4], DMA_TO_DEVICE,
+-                         (slow ? STp->long_timeout : STp->device->timeout), 0, 1);
++                         (slow ? STp->long_timeout : STp->device->request_queue->rq_timeout), 0, 1);
+       if (SRpnt == NULL)
+               return (STp->buffer)->syscall_result;
+@@ -2464,7 +2472,7 @@ static int do_load_unload(struct scsi_ta
+       }
+       if (STp->immediate) {
+               cmd[1] = 1;     /* Don't wait for completion */
+-              timeout = STp->device->timeout;
++              timeout = STp->device->request_queue->rq_timeout;
+       }
+       else
+               timeout = STp->long_timeout;
+@@ -2638,7 +2646,7 @@ static int st_int_ioctl(struct scsi_tape
+               cmd[2] = (arg >> 16);
+               cmd[3] = (arg >> 8);
+               cmd[4] = arg;
+-              timeout = STp->device->timeout;
++              timeout = STp->device->request_queue->rq_timeout;
+                 DEBC(
+                      if (cmd_in == MTWEOF)
+                                printk(ST_DEB_MSG "%s: Writing %d filemarks.\n", name,
+@@ -2656,7 +2664,7 @@ static int st_int_ioctl(struct scsi_tape
+               cmd[0] = REZERO_UNIT;
+               if (STp->immediate) {
+                       cmd[1] = 1;     /* Don't wait for completion */
+-                      timeout = STp->device->timeout;
++                      timeout = STp->device->request_queue->rq_timeout;
+               }
+                 DEBC(printk(ST_DEB_MSG "%s: Rewinding tape.\n", name));
+               fileno = blkno = at_sm = 0;
+@@ -2669,7 +2677,7 @@ static int st_int_ioctl(struct scsi_tape
+               cmd[0] = START_STOP;
+               if (STp->immediate) {
+                       cmd[1] = 1;     /* Don't wait for completion */
+-                      timeout = STp->device->timeout;
++                      timeout = STp->device->request_queue->rq_timeout;
+               }
+               cmd[4] = 3;
+                 DEBC(printk(ST_DEB_MSG "%s: Retensioning tape.\n", name));
+@@ -2702,7 +2710,7 @@ static int st_int_ioctl(struct scsi_tape
+               cmd[1] = (arg ? 1 : 0); /* Long erase with non-zero argument */
+               if (STp->immediate) {
+                       cmd[1] |= 2;    /* Don't wait for completion */
+-                      timeout = STp->device->timeout;
++                      timeout = STp->device->request_queue->rq_timeout;
+               }
+               else
+                       timeout = STp->long_timeout * 8;
+@@ -2754,7 +2762,7 @@ static int st_int_ioctl(struct scsi_tape
+               (STp->buffer)->b_data[9] = (ltmp >> 16);
+               (STp->buffer)->b_data[10] = (ltmp >> 8);
+               (STp->buffer)->b_data[11] = ltmp;
+-              timeout = STp->device->timeout;
++              timeout = STp->device->request_queue->rq_timeout;
+                 DEBC(
+                       if (cmd_in == MTSETBLK || cmd_in == SET_DENS_AND_BLK)
+                               printk(ST_DEB_MSG
+@@ -2944,7 +2952,8 @@ static int get_location(struct scsi_tape
+                       scmd[1] = 1;
+       }
+       SRpnt = st_do_scsi(NULL, STp, scmd, 20, DMA_FROM_DEVICE,
+-                      STp->device->timeout, MAX_READY_RETRIES, 1);
++                         STp->device->request_queue->rq_timeout,
++                         MAX_READY_RETRIES, 1);
+       if (!SRpnt)
+               return (STp->buffer)->syscall_result;
+@@ -3045,7 +3054,7 @@ static int set_location(struct scsi_tape
+       }
+       if (STp->immediate) {
+               scmd[1] |= 1;           /* Don't wait for completion */
+-              timeout = STp->device->timeout;
++              timeout = STp->device->request_queue->rq_timeout;
+       }
+       SRpnt = st_do_scsi(NULL, STp, scmd, 0, DMA_NONE,
+@@ -4028,7 +4037,7 @@ static int st_probe(struct device *dev)
+       tpnt->partition = 0;
+       tpnt->new_partition = 0;
+       tpnt->nbr_partitions = 0;
+-      tpnt->device->timeout = ST_TIMEOUT;
++      blk_queue_rq_timeout(tpnt->device->request_queue, ST_TIMEOUT);
+       tpnt->long_timeout = ST_LONG_TIMEOUT;
+       tpnt->try_dio = try_direct_io && !SDp->host->unchecked_isa_dma;
+--- a/drivers/scsi/stex.c
++++ b/drivers/scsi/stex.c
+@@ -477,7 +477,7 @@ stex_slave_config(struct scsi_device *sd
+ {
+       sdev->use_10_for_rw = 1;
+       sdev->use_10_for_ms = 1;
+-      sdev->timeout = 60 * HZ;
++      blk_queue_rq_timeout(sdev->request_queue, 60 * HZ);
+       sdev->tagged_supported = 1;
+       return 0;
+--- a/include/scsi/scsi_device.h
++++ b/include/scsi/scsi_device.h
+@@ -160,8 +160,6 @@ struct scsi_device {
+       atomic_t iodone_cnt;
+       atomic_t ioerr_cnt;
+-      int timeout;
+-
+       struct device           sdev_gendev,
+                               sdev_dev;