diff options
| author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-03 14:26:39 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-03 14:26:39 -0500 |
| commit | ce35a81a71f405031ed6fd0d454d3aaa55dc8ed2 (patch) | |
| tree | ba67cda811c798970ed89786f2e4a60618cb0975 | |
| parent | 259886a7c4e4eb0089181e800d1f477cb3786875 (diff) | |
| parent | 017f2e37ae19ccd28e5edd965741fc374194c5dd (diff) | |
Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6:
[SCSI] sd: udev accessing an uninitialized scsi_disk field results in a crash
[SCSI] st: A MTIOCTOP/MTWEOF within the early warning will cause the file number to be incorrect
[SCSI] qla4xxx: bug fixes
[SCSI] Fix scsi_add_device() for async scanning
| -rw-r--r-- | drivers/scsi/qla4xxx/ql4_def.h | 1 | ||||
| -rw-r--r-- | drivers/scsi/qla4xxx/ql4_glbl.h | 1 | ||||
| -rw-r--r-- | drivers/scsi/qla4xxx/ql4_init.c | 18 | ||||
| -rw-r--r-- | drivers/scsi/qla4xxx/ql4_isr.c | 4 | ||||
| -rw-r--r-- | drivers/scsi/qla4xxx/ql4_mbx.c | 35 | ||||
| -rw-r--r-- | drivers/scsi/qla4xxx/ql4_os.c | 64 | ||||
| -rw-r--r-- | drivers/scsi/qla4xxx/ql4_version.h | 2 | ||||
| -rw-r--r-- | drivers/scsi/scsi_scan.c | 6 | ||||
| -rw-r--r-- | drivers/scsi/sd.c | 20 | ||||
| -rw-r--r-- | drivers/scsi/st.c | 19 |
10 files changed, 100 insertions, 70 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h index 4249e52a5592..6f4cf2dd2f4a 100644 --- a/drivers/scsi/qla4xxx/ql4_def.h +++ b/drivers/scsi/qla4xxx/ql4_def.h | |||
| @@ -418,7 +418,6 @@ struct scsi_qla_host { | |||
| 418 | * concurrently. | 418 | * concurrently. |
| 419 | */ | 419 | */ |
| 420 | struct mutex mbox_sem; | 420 | struct mutex mbox_sem; |
| 421 | wait_queue_head_t mailbox_wait_queue; | ||
| 422 | 421 | ||
| 423 | /* temporary mailbox status registers */ | 422 | /* temporary mailbox status registers */ |
| 424 | volatile uint8_t mbox_status_count; | 423 | volatile uint8_t mbox_status_count; |
diff --git a/drivers/scsi/qla4xxx/ql4_glbl.h b/drivers/scsi/qla4xxx/ql4_glbl.h index 2122967bbf0b..e021eb5db2b2 100644 --- a/drivers/scsi/qla4xxx/ql4_glbl.h +++ b/drivers/scsi/qla4xxx/ql4_glbl.h | |||
| @@ -76,4 +76,5 @@ int qla4xxx_process_ddb_changed(struct scsi_qla_host * ha, | |||
| 76 | extern int ql4xextended_error_logging; | 76 | extern int ql4xextended_error_logging; |
| 77 | extern int ql4xdiscoverywait; | 77 | extern int ql4xdiscoverywait; |
| 78 | extern int ql4xdontresethba; | 78 | extern int ql4xdontresethba; |
| 79 | extern int ql4_mod_unload; | ||
| 79 | #endif /* _QLA4x_GBL_H */ | 80 | #endif /* _QLA4x_GBL_H */ |
diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c index cc210f297a78..b907b06d72ab 100644 --- a/drivers/scsi/qla4xxx/ql4_init.c +++ b/drivers/scsi/qla4xxx/ql4_init.c | |||
| @@ -958,25 +958,25 @@ static int qla4xxx_start_firmware_from_flash(struct scsi_qla_host *ha) | |||
| 958 | return status; | 958 | return status; |
| 959 | } | 959 | } |
| 960 | 960 | ||
| 961 | int ql4xxx_lock_drvr_wait(struct scsi_qla_host *a) | 961 | int ql4xxx_lock_drvr_wait(struct scsi_qla_host *ha) |
| 962 | { | 962 | { |
| 963 | #define QL4_LOCK_DRVR_WAIT 300 | 963 | #define QL4_LOCK_DRVR_WAIT 30 |
| 964 | #define QL4_LOCK_DRVR_SLEEP 100 | 964 | #define QL4_LOCK_DRVR_SLEEP 1 |
| 965 | 965 | ||
| 966 | int drvr_wait = QL4_LOCK_DRVR_WAIT; | 966 | int drvr_wait = QL4_LOCK_DRVR_WAIT; |
| 967 | while (drvr_wait) { | 967 | while (drvr_wait) { |
| 968 | if (ql4xxx_lock_drvr(a) == 0) { | 968 | if (ql4xxx_lock_drvr(ha) == 0) { |
| 969 | msleep(QL4_LOCK_DRVR_SLEEP); | 969 | ssleep(QL4_LOCK_DRVR_SLEEP); |
| 970 | if (drvr_wait) { | 970 | if (drvr_wait) { |
| 971 | DEBUG2(printk("scsi%ld: %s: Waiting for " | 971 | DEBUG2(printk("scsi%ld: %s: Waiting for " |
| 972 | "Global Init Semaphore...n", | 972 | "Global Init Semaphore(%d)...n", |
| 973 | a->host_no, | 973 | ha->host_no, |
| 974 | __func__)); | 974 | __func__, drvr_wait)); |
| 975 | } | 975 | } |
| 976 | drvr_wait -= QL4_LOCK_DRVR_SLEEP; | 976 | drvr_wait -= QL4_LOCK_DRVR_SLEEP; |
| 977 | } else { | 977 | } else { |
| 978 | DEBUG2(printk("scsi%ld: %s: Global Init Semaphore " | 978 | DEBUG2(printk("scsi%ld: %s: Global Init Semaphore " |
| 979 | "acquired.n", a->host_no, __func__)); | 979 | "acquired.n", ha->host_no, __func__)); |
| 980 | return QLA_SUCCESS; | 980 | return QLA_SUCCESS; |
| 981 | } | 981 | } |
| 982 | } | 982 | } |
diff --git a/drivers/scsi/qla4xxx/ql4_isr.c b/drivers/scsi/qla4xxx/ql4_isr.c index ef975e0dc87f..35b9e36a0e8d 100644 --- a/drivers/scsi/qla4xxx/ql4_isr.c +++ b/drivers/scsi/qla4xxx/ql4_isr.c | |||
| @@ -433,7 +433,6 @@ static void qla4xxx_isr_decode_mailbox(struct scsi_qla_host * ha, | |||
| 433 | readl(&ha->reg->mailbox[i]); | 433 | readl(&ha->reg->mailbox[i]); |
| 434 | 434 | ||
| 435 | set_bit(AF_MBOX_COMMAND_DONE, &ha->flags); | 435 | set_bit(AF_MBOX_COMMAND_DONE, &ha->flags); |
| 436 | wake_up(&ha->mailbox_wait_queue); | ||
| 437 | } | 436 | } |
| 438 | } else if (mbox_status >> 12 == MBOX_ASYNC_EVENT_STATUS) { | 437 | } else if (mbox_status >> 12 == MBOX_ASYNC_EVENT_STATUS) { |
| 439 | /* Immediately process the AENs that don't require much work. | 438 | /* Immediately process the AENs that don't require much work. |
| @@ -686,7 +685,8 @@ irqreturn_t qla4xxx_intr_handler(int irq, void *dev_id) | |||
| 686 | &ha->reg->ctrl_status); | 685 | &ha->reg->ctrl_status); |
| 687 | readl(&ha->reg->ctrl_status); | 686 | readl(&ha->reg->ctrl_status); |
| 688 | 687 | ||
| 689 | set_bit(DPC_RESET_HA_INTR, &ha->dpc_flags); | 688 | if (!ql4_mod_unload) |
| 689 | set_bit(DPC_RESET_HA_INTR, &ha->dpc_flags); | ||
| 690 | 690 | ||
| 691 | break; | 691 | break; |
| 692 | } else if (intr_status & INTR_PENDING) { | 692 | } else if (intr_status & INTR_PENDING) { |
diff --git a/drivers/scsi/qla4xxx/ql4_mbx.c b/drivers/scsi/qla4xxx/ql4_mbx.c index b721dc5dd711..7f28657eef3f 100644 --- a/drivers/scsi/qla4xxx/ql4_mbx.c +++ b/drivers/scsi/qla4xxx/ql4_mbx.c | |||
| @@ -29,18 +29,30 @@ int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount, | |||
| 29 | u_long wait_count; | 29 | u_long wait_count; |
| 30 | uint32_t intr_status; | 30 | uint32_t intr_status; |
| 31 | unsigned long flags = 0; | 31 | unsigned long flags = 0; |
| 32 | DECLARE_WAITQUEUE(wait, current); | ||
| 33 | |||
| 34 | mutex_lock(&ha->mbox_sem); | ||
| 35 | |||
| 36 | /* Mailbox code active */ | ||
| 37 | set_bit(AF_MBOX_COMMAND, &ha->flags); | ||
| 38 | 32 | ||
| 39 | /* Make sure that pointers are valid */ | 33 | /* Make sure that pointers are valid */ |
| 40 | if (!mbx_cmd || !mbx_sts) { | 34 | if (!mbx_cmd || !mbx_sts) { |
| 41 | DEBUG2(printk("scsi%ld: %s: Invalid mbx_cmd or mbx_sts " | 35 | DEBUG2(printk("scsi%ld: %s: Invalid mbx_cmd or mbx_sts " |
| 42 | "pointer\n", ha->host_no, __func__)); | 36 | "pointer\n", ha->host_no, __func__)); |
| 43 | goto mbox_exit; | 37 | return status; |
| 38 | } | ||
| 39 | /* Mailbox code active */ | ||
| 40 | wait_count = MBOX_TOV * 100; | ||
| 41 | |||
| 42 | while (wait_count--) { | ||
| 43 | mutex_lock(&ha->mbox_sem); | ||
| 44 | if (!test_bit(AF_MBOX_COMMAND, &ha->flags)) { | ||
| 45 | set_bit(AF_MBOX_COMMAND, &ha->flags); | ||
| 46 | mutex_unlock(&ha->mbox_sem); | ||
| 47 | break; | ||
| 48 | } | ||
| 49 | mutex_unlock(&ha->mbox_sem); | ||
| 50 | if (!wait_count) { | ||
| 51 | DEBUG2(printk("scsi%ld: %s: mbox_sem failed\n", | ||
| 52 | ha->host_no, __func__)); | ||
| 53 | return status; | ||
| 54 | } | ||
| 55 | msleep(10); | ||
| 44 | } | 56 | } |
| 45 | 57 | ||
| 46 | /* To prevent overwriting mailbox registers for a command that has | 58 | /* To prevent overwriting mailbox registers for a command that has |
| @@ -73,8 +85,6 @@ int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount, | |||
| 73 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 85 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
| 74 | 86 | ||
| 75 | /* Wait for completion */ | 87 | /* Wait for completion */ |
| 76 | set_current_state(TASK_UNINTERRUPTIBLE); | ||
| 77 | add_wait_queue(&ha->mailbox_wait_queue, &wait); | ||
| 78 | 88 | ||
| 79 | /* | 89 | /* |
| 80 | * If we don't want status, don't wait for the mailbox command to | 90 | * If we don't want status, don't wait for the mailbox command to |
| @@ -83,8 +93,6 @@ int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount, | |||
| 83 | */ | 93 | */ |
| 84 | if (outCount == 0) { | 94 | if (outCount == 0) { |
| 85 | status = QLA_SUCCESS; | 95 | status = QLA_SUCCESS; |
| 86 | set_current_state(TASK_RUNNING); | ||
| 87 | remove_wait_queue(&ha->mailbox_wait_queue, &wait); | ||
| 88 | goto mbox_exit; | 96 | goto mbox_exit; |
| 89 | } | 97 | } |
| 90 | /* Wait for command to complete */ | 98 | /* Wait for command to complete */ |
| @@ -108,8 +116,6 @@ int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount, | |||
| 108 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 116 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
| 109 | msleep(10); | 117 | msleep(10); |
| 110 | } | 118 | } |
| 111 | set_current_state(TASK_RUNNING); | ||
| 112 | remove_wait_queue(&ha->mailbox_wait_queue, &wait); | ||
| 113 | 119 | ||
| 114 | /* Check for mailbox timeout. */ | 120 | /* Check for mailbox timeout. */ |
| 115 | if (!test_bit(AF_MBOX_COMMAND_DONE, &ha->flags)) { | 121 | if (!test_bit(AF_MBOX_COMMAND_DONE, &ha->flags)) { |
| @@ -155,9 +161,10 @@ int qla4xxx_mailbox_command(struct scsi_qla_host *ha, uint8_t inCount, | |||
| 155 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | 161 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
| 156< | |||
