aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/qla2xxx/qla_os.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c
index 5a542655d442..af9b4e77cbff 100644
--- a/drivers/scsi/qla2xxx/qla_os.c
+++ b/drivers/scsi/qla2xxx/qla_os.c
@@ -502,14 +502,13 @@ qc24_fail_command:
502static int 502static int
503qla2x00_eh_wait_on_command(scsi_qla_host_t *ha, struct scsi_cmnd *cmd) 503qla2x00_eh_wait_on_command(scsi_qla_host_t *ha, struct scsi_cmnd *cmd)
504{ 504{
505#define ABORT_POLLING_PERIOD HZ 505#define ABORT_POLLING_PERIOD 1000
506#define ABORT_WAIT_ITER ((10 * HZ) / (ABORT_POLLING_PERIOD)) 506#define ABORT_WAIT_ITER ((10 * 1000) / (ABORT_POLLING_PERIOD))
507 unsigned long wait_iter = ABORT_WAIT_ITER; 507 unsigned long wait_iter = ABORT_WAIT_ITER;
508 int ret = QLA_SUCCESS; 508 int ret = QLA_SUCCESS;
509 509
510 while (CMD_SP(cmd)) { 510 while (CMD_SP(cmd)) {
511 set_current_state(TASK_UNINTERRUPTIBLE); 511 msleep(ABORT_POLLING_PERIOD);
512 schedule_timeout(ABORT_POLLING_PERIOD);
513 512
514 if (--wait_iter) 513 if (--wait_iter)
515 break; 514 break;
@@ -1960,7 +1959,7 @@ qla2x00_mem_free(scsi_qla_host_t *ha)
1960{ 1959{
1961 struct list_head *fcpl, *fcptemp; 1960 struct list_head *fcpl, *fcptemp;
1962 fc_port_t *fcport; 1961 fc_port_t *fcport;
1963 unsigned long wtime;/* max wait time if mbx cmd is busy. */ 1962 unsigned int wtime;/* max wait time if mbx cmd is busy. */
1964 1963
1965 if (ha == NULL) { 1964 if (ha == NULL) {
1966 /* error */ 1965 /* error */
@@ -1969,11 +1968,9 @@ qla2x00_mem_free(scsi_qla_host_t *ha)
1969 } 1968 }
1970 1969
1971 /* Make sure all other threads are stopped. */ 1970 /* Make sure all other threads are stopped. */
1972 wtime = 60 * HZ; 1971 wtime = 60 * 1000;
1973 while (ha->dpc_wait && wtime) { 1972 while (ha->dpc_wait && wtime)
1974 set_current_state(TASK_INTERRUPTIBLE); 1973 wtime = msleep_interruptible(wtime);
1975 wtime = schedule_timeout(wtime);
1976 }
1977 1974
1978 /* free ioctl memory */ 1975 /* free ioctl memory */
1979 qla2x00_free_ioctl_mem(ha); 1976 qla2x00_free_ioctl_mem(ha);
@@ -2504,15 +2501,15 @@ qla2x00_timer(scsi_qla_host_t *ha)
2504int 2501int
2505qla2x00_down_timeout(struct semaphore *sema, unsigned long timeout) 2502qla2x00_down_timeout(struct semaphore *sema, unsigned long timeout)
2506{ 2503{
2507 const unsigned int step = HZ/10; 2504 const unsigned int step = 100; /* msecs */
2505 unsigned int iterations = jiffies_to_msecs(timeout)/100;
2508 2506
2509 do { 2507 do {
2510 if (!down_trylock(sema)) 2508 if (!down_trylock(sema))
2511 return 0; 2509 return 0;
2512 set_current_state(TASK_INTERRUPTIBLE); 2510 if (msleep_interruptible(step))
2513 if (schedule_timeout(step))
2514 break; 2511 break;
2515 } while ((timeout -= step) > 0); 2512 } while (--iterations >= 0);
2516 2513
2517 return -ETIMEDOUT; 2514 return -ETIMEDOUT;
2518} 2515}