Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+100 -70
-1
drivers/scsi/qla4xxx/ql4_def.h
··· 418 418 * concurrently. 419 419 */ 420 420 struct mutex mbox_sem; 421 - wait_queue_head_t mailbox_wait_queue; 422 421 423 422 /* temporary mailbox status registers */ 424 423 volatile uint8_t mbox_status_count;
+1
drivers/scsi/qla4xxx/ql4_glbl.h
··· 76 76 extern int ql4xextended_error_logging; 77 77 extern int ql4xdiscoverywait; 78 78 extern int ql4xdontresethba; 79 + extern int ql4_mod_unload; 79 80 #endif /* _QLA4x_GBL_H */
+9 -9
drivers/scsi/qla4xxx/ql4_init.c
··· 958 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 964 - #define QL4_LOCK_DRVR_SLEEP 100 963 + #define QL4_LOCK_DRVR_WAIT 30 964 + #define QL4_LOCK_DRVR_SLEEP 1 965 965 966 966 int drvr_wait = QL4_LOCK_DRVR_WAIT; 967 967 while (drvr_wait) { 968 - if (ql4xxx_lock_drvr(a) == 0) { 969 - msleep(QL4_LOCK_DRVR_SLEEP); 968 + if (ql4xxx_lock_drvr(ha) == 0) { 969 + ssleep(QL4_LOCK_DRVR_SLEEP); 970 970 if (drvr_wait) { 971 971 DEBUG2(printk("scsi%ld: %s: Waiting for " 972 - "Global Init Semaphore...n", 973 - a->host_no, 974 - __func__)); 972 + "Global Init Semaphore(%d)...n", 973 + ha->host_no, 974 + __func__, drvr_wait)); 975 975 } 976 976 drvr_wait -= QL4_LOCK_DRVR_SLEEP; 977 977 } else { 978 978 DEBUG2(printk("scsi%ld: %s: Global Init Semaphore " 979 - "acquired.n", a->host_no, __func__)); 979 + "acquired.n", ha->host_no, __func__)); 980 980 return QLA_SUCCESS; 981 981 } 982 982 }
+2 -2
drivers/scsi/qla4xxx/ql4_isr.c
··· 433 433 readl(&ha->reg->mailbox[i]); 434 434 435 435 set_bit(AF_MBOX_COMMAND_DONE, &ha->flags); 436 - wake_up(&ha->mailbox_wait_queue); 437 436 } 438 437 } else if (mbox_status >> 12 == MBOX_ASYNC_EVENT_STATUS) { 439 438 /* Immediately process the AENs that don't require much work. ··· 685 686 &ha->reg->ctrl_status); 686 687 readl(&ha->reg->ctrl_status); 687 688 688 - set_bit(DPC_RESET_HA_INTR, &ha->dpc_flags); 689 + if (!ql4_mod_unload) 690 + set_bit(DPC_RESET_HA_INTR, &ha->dpc_flags); 689 691 690 692 break; 691 693 } else if (intr_status & INTR_PENDING) {
+21 -14
drivers/scsi/qla4xxx/ql4_mbx.c
··· 29 29 u_long wait_count; 30 30 uint32_t intr_status; 31 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 33 /* Make sure that pointers are valid */ 40 34 if (!mbx_cmd || !mbx_sts) { 41 35 DEBUG2(printk("scsi%ld: %s: Invalid mbx_cmd or mbx_sts " 42 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 58 /* To prevent overwriting mailbox registers for a command that has ··· 85 73 spin_unlock_irqrestore(&ha->hardware_lock, flags); 86 74 87 75 /* Wait for completion */ 88 - set_current_state(TASK_UNINTERRUPTIBLE); 89 - add_wait_queue(&ha->mailbox_wait_queue, &wait); 90 76 91 77 /* 92 78 * If we don't want status, don't wait for the mailbox command to ··· 93 83 */ 94 84 if (outCount == 0) { 95 85 status = QLA_SUCCESS; 96 - set_current_state(TASK_RUNNING); 97 - remove_wait_queue(&ha->mailbox_wait_queue, &wait); 98 86 goto mbox_exit; 99 87 } 100 88 /* Wait for command to complete */ ··· 116 108 spin_unlock_irqrestore(&ha->hardware_lock, flags); 117 109 msleep(10); 118 110 } 119 - set_current_state(TASK_RUNNING); 120 - remove_wait_queue(&ha->mailbox_wait_queue, &wait); 121 111 122 112 /* Check for mailbox timeout. */ 123 113 if (!test_bit(AF_MBOX_COMMAND_DONE, &ha->flags)) { ··· 161 155 spin_unlock_irqrestore(&ha->hardware_lock, flags); 162 156 163 157 mbox_exit: 158 + mutex_lock(&ha->mbox_sem); 164 159 clear_bit(AF_MBOX_COMMAND, &ha->flags); 165 - clear_bit(AF_MBOX_COMMAND_DONE, &ha->flags); 166 160 mutex_unlock(&ha->mbox_sem); 161 + clear_bit(AF_MBOX_COMMAND_DONE, &ha->flags); 167 162 168 163 return status; 169 164 }
+39 -25
drivers/scsi/qla4xxx/ql4_os.c
··· 40 40 "Option to enable extended error logging, " 41 41 "Default is 0 - no logging, 1 - debug logging"); 42 42 43 + int ql4_mod_unload = 0; 44 + 43 45 /* 44 46 * SCSI host template entry points 45 47 */ ··· 424 422 goto qc_host_busy; 425 423 } 426 424 425 + if (test_bit(DPC_RESET_HA_INTR, &ha->dpc_flags)) 426 + goto qc_host_busy; 427 + 427 428 spin_unlock_irq(ha->host->host_lock); 428 429 429 430 srb = qla4xxx_get_new_srb(ha, ddb_entry, cmd, done); ··· 712 707 return stat; 713 708 } 714 709 715 - /** 716 - * qla4xxx_soft_reset - performs soft reset. 717 - * @ha: Pointer to host adapter structure. 718 - **/ 719 - int qla4xxx_soft_reset(struct scsi_qla_host *ha) 710 + static void qla4xxx_hw_reset(struct scsi_qla_host *ha) 720 711 { 721 - uint32_t max_wait_time; 722 - unsigned long flags = 0; 723 - int status = QLA_ERROR; 724 712 uint32_t ctrl_status; 713 + unsigned long flags = 0; 714 + 715 + DEBUG2(printk(KERN_ERR "scsi%ld: %s\n", ha->host_no, __func__)); 725 716 726 717 spin_lock_irqsave(&ha->hardware_lock, flags); 727 718 ··· 734 733 readl(&ha->reg->ctrl_status); 735 734 736 735 spin_unlock_irqrestore(&ha->hardware_lock, flags); 736 + } 737 + 738 + /** 739 + * qla4xxx_soft_reset - performs soft reset. 740 + * @ha: Pointer to host adapter structure. 741 + **/ 742 + int qla4xxx_soft_reset(struct scsi_qla_host *ha) 743 + { 744 + uint32_t max_wait_time; 745 + unsigned long flags = 0; 746 + int status = QLA_ERROR; 747 + uint32_t ctrl_status; 748 + 749 + qla4xxx_hw_reset(ha); 737 750 738 751 /* Wait until the Network Reset Intr bit is cleared */ 739 752 max_wait_time = RESET_INTR_TOV; ··· 981 966 struct scsi_qla_host *ha = 982 967 container_of(work, struct scsi_qla_host, dpc_work); 983 968 struct ddb_entry *ddb_entry, *dtemp; 969 + int status = QLA_ERROR; 984 970 985 971 DEBUG2(printk("scsi%ld: %s: DPC handler waking up." 986 - "flags = 0x%08lx, dpc_flags = 0x%08lx\n", 987 - ha->host_no, __func__, ha->flags, ha->dpc_flags)); 972 + "flags = 0x%08lx, dpc_flags = 0x%08lx ctrl_stat = 0x%08x\n", 973 + ha->host_no, __func__, ha->flags, ha->dpc_flags, 974 + readw(&ha->reg->ctrl_status))); 988 975 989 976 /* Initialization not yet finished. Don't do anything yet. */ 990 977 if (!test_bit(AF_INIT_DONE, &ha->flags)) ··· 1000 983 test_bit(DPC_RESET_HA, &ha->dpc_flags)) 1001 984 qla4xxx_recover_adapter(ha, PRESERVE_DDB_LIST); 1002 985 1003 - if (test_and_clear_bit(DPC_RESET_HA_INTR, &ha->dpc_flags)) { 986 + if (test_bit(DPC_RESET_HA_INTR, &ha->dpc_flags)) { 1004 987 uint8_t wait_time = RESET_INTR_TOV; 1005 - unsigned long flags = 0; 1006 988 1007 - qla4xxx_flush_active_srbs(ha); 1008 - 1009 - spin_lock_irqsave(&ha->hardware_lock, flags); 1010 989 while ((readw(&ha->reg->ctrl_status) & 1011 990 (CSR_SOFT_RESET | CSR_FORCE_SOFT_RESET)) != 0) { 1012 991 if (--wait_time == 0) 1013 992 break; 1014 - 1015 - spin_unlock_irqrestore(&ha->hardware_lock, 1016 - flags); 1017 - 1018 993 msleep(1000); 1019 - 1020 - spin_lock_irqsave(&ha->hardware_lock, flags); 1021 994 } 1022 - spin_unlock_irqrestore(&ha->hardware_lock, flags); 1023 - 1024 995 if (wait_time == 0) 1025 996 DEBUG2(printk("scsi%ld: %s: SR|FSR " 1026 997 "bit not cleared-- resetting\n", 1027 998 ha->host_no, __func__)); 999 + qla4xxx_flush_active_srbs(ha); 1000 + if (ql4xxx_lock_drvr_wait(ha) == QLA_SUCCESS) { 1001 + qla4xxx_process_aen(ha, FLUSH_DDB_CHANGED_AENS); 1002 + status = qla4xxx_initialize_adapter(ha, 1003 + PRESERVE_DDB_LIST); 1004 + } 1005 + clear_bit(DPC_RESET_HA_INTR, &ha->dpc_flags); 1006 + if (status == QLA_SUCCESS) 1007 + qla4xxx_enable_intrs(ha); 1028 1008 } 1029 1009 } 1030 1010 ··· 1076 1062 1077 1063 /* Issue Soft Reset to put firmware in unknown state */ 1078 1064 if (ql4xxx_lock_drvr_wait(ha) == QLA_SUCCESS) 1079 - qla4xxx_soft_reset(ha); 1065 + qla4xxx_hw_reset(ha); 1080 1066 1081 1067 /* Remove timer thread, if present */ 1082 1068 if (ha->timer_active) ··· 1212 1198 INIT_LIST_HEAD(&ha->free_srb_q); 1213 1199 1214 1200 mutex_init(&ha->mbox_sem); 1215 - init_waitqueue_head(&ha->mailbox_wait_queue); 1216 1201 1217 1202 spin_lock_init(&ha->hardware_lock); 1218 1203 ··· 1678 1665 1679 1666 static void __exit qla4xxx_module_exit(void) 1680 1667 { 1668 + ql4_mod_unload = 1; 1681 1669 pci_unregister_driver(&qla4xxx_pci_driver); 1682 1670 iscsi_unregister_transport(&qla4xxx_iscsi_transport); 1683 1671 kmem_cache_destroy(srb_cachep);
+1 -1
drivers/scsi/qla4xxx/ql4_version.h
··· 5 5 * See LICENSE.qla4xxx for copyright and licensing details. 6 6 */ 7 7 8 - #define QLA4XXX_DRIVER_VERSION "5.00.07-k" 8 + #define QLA4XXX_DRIVER_VERSION "5.00.07-k1"
+6
drivers/scsi/scsi_scan.c
··· 1453 1453 struct device *parent = &shost->shost_gendev; 1454 1454 struct scsi_target *starget; 1455 1455 1456 + if (strncmp(scsi_scan_type, "none", 4) == 0) 1457 + return ERR_PTR(-ENODEV); 1458 + 1459 + if (!shost->async_scan) 1460 + scsi_complete_async_scans(); 1461 + 1456 1462 starget = scsi_alloc_target(parent, channel, id); 1457 1463 if (!starget) 1458 1464 return ERR_PTR(-ENOMEM);
+10 -10
drivers/scsi/sd.c
··· 1647 1647 if (error) 1648 1648 goto out_put; 1649 1649 1650 - class_device_initialize(&sdkp->cdev); 1651 - sdkp->cdev.dev = &sdp->sdev_gendev; 1652 - sdkp->cdev.class = &sd_disk_class; 1653 - strncpy(sdkp->cdev.class_id, sdp->sdev_gendev.bus_id, BUS_ID_SIZE); 1654 - 1655 - if (class_device_add(&sdkp->cdev)) 1656 - goto out_put; 1657 - 1658 - get_device(&sdp->sdev_gendev); 1659 - 1660 1650 sdkp->device = sdp; 1661 1651 sdkp->driver = &sd_template; 1662 1652 sdkp->disk = gd; ··· 1659 1669 else 1660 1670 sdp->timeout = SD_MOD_TIMEOUT; 1661 1671 } 1672 + 1673 + class_device_initialize(&sdkp->cdev); 1674 + sdkp->cdev.dev = &sdp->sdev_gendev; 1675 + sdkp->cdev.class = &sd_disk_class; 1676 + strncpy(sdkp->cdev.class_id, sdp->sdev_gendev.bus_id, BUS_ID_SIZE); 1677 + 1678 + if (class_device_add(&sdkp->cdev)) 1679 + goto out_put; 1680 + 1681 + get_device(&sdp->sdev_gendev); 1662 1682 1663 1683 gd->major = sd_major((index & 0xf0) >> 4); 1664 1684 gd->first_minor = ((index & 0xf) << 4) | (index & 0xfff00);
+11 -8
drivers/scsi/st.c
··· 2816 2816 2817 2817 if (cmd_in == MTWEOF && 2818 2818 cmdstatp->have_sense && 2819 - (cmdstatp->flags & SENSE_EOM) && 2820 - (cmdstatp->sense_hdr.sense_key == NO_SENSE || 2821 - cmdstatp->sense_hdr.sense_key == RECOVERED_ERROR) && 2822 - undone == 0) { 2823 - ioctl_result = 0; /* EOF written successfully at EOM */ 2824 - if (fileno >= 0) 2825 - fileno++; 2819 + (cmdstatp->flags & SENSE_EOM)) { 2820 + if (cmdstatp->sense_hdr.sense_key == NO_SENSE || 2821 + cmdstatp->sense_hdr.sense_key == RECOVERED_ERROR) { 2822 + ioctl_result = 0; /* EOF(s) written successfully at EOM */ 2823 + STps->eof = ST_NOEOF; 2824 + } else { /* Writing EOF(s) failed */ 2825 + if (fileno >= 0) 2826 + fileno -= undone; 2827 + if (undone < arg) 2828 + STps->eof = ST_NOEOF; 2829 + } 2826 2830 STps->drv_file = fileno; 2827 - STps->eof = ST_NOEOF; 2828 2831 } else if ((cmd_in == MTFSF) || (cmd_in == MTFSFM)) { 2829 2832 if (fileno >= 0) 2830 2833 STps->drv_file = fileno - undone;