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 git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6:
[SCSI] fix use-after-free in scsi_init_io()
[SCSI] sd: fix medium-removal bug
[SCSI] qla2xxx: Update version number to 8.03.04-k0.
[SCSI] qla2xxx: Check for empty slot in request queue before posting Command type 6 request.
[SCSI] qla2xxx: Cover UNDERRUN case where SCSI status is set.
[SCSI] qla2xxx: Correctly set fw hung and complete only waiting mbx.
[SCSI] qla2xxx: Reset seconds_since_last_heartbeat correctly.
[SCSI] qla2xxx: make rport deletions explicit during vport removal
[SCSI] qla2xxx: Fix vport delete issues
[SCSI] sd, sym53c8xx: Remove warnings after vsprintf %pV introducation.
[SCSI] Fix warning: zero-length gnu_printf format string
[SCSI] hpsa: disable doorbell reset on reset_devices
[SCSI] be2iscsi: Fix for Login failure
[SCSI] fix bio.bi_rw handling

+262 -70
+2 -3
drivers/scsi/be2iscsi/be_iscsi.c
··· 300 300 enum iscsi_host_param param, char *buf) 301 301 { 302 302 struct beiscsi_hba *phba = (struct beiscsi_hba *)iscsi_host_priv(shost); 303 - int len = 0; 304 - int status; 303 + int status = 0; 305 304 306 305 SE_DEBUG(DBG_LVL_8, "In beiscsi_get_host_param, param= %d\n", param); 307 306 switch (param) { ··· 314 315 default: 315 316 return iscsi_host_get_param(shost, param, buf); 316 317 } 317 - return len; 318 + return status; 318 319 } 319 320 320 321 int beiscsi_get_macaddr(char *buf, struct beiscsi_hba *phba)
+1 -1
drivers/scsi/be2iscsi/be_mgmt.c
··· 368 368 memset(req, 0, sizeof(*req)); 369 369 wrb->tag0 |= tag; 370 370 371 - be_wrb_hdr_prepare(wrb, sizeof(*req), true, 1); 371 + be_wrb_hdr_prepare(wrb, sizeof(*req), false, 1); 372 372 be_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ISCSI, 373 373 OPCODE_COMMON_ISCSI_TCP_CONNECT_AND_OFFLOAD, 374 374 sizeof(*req));
+3 -3
drivers/scsi/constants.c
··· 1404 1404 { 1405 1405 struct scsi_sense_hdr sshdr; 1406 1406 1407 - scmd_printk(KERN_INFO, cmd, ""); 1407 + scmd_printk(KERN_INFO, cmd, " "); 1408 1408 scsi_decode_sense_buffer(cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE, 1409 1409 &sshdr); 1410 1410 scsi_show_sense_hdr(&sshdr); 1411 1411 scsi_decode_sense_extras(cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE, 1412 1412 &sshdr); 1413 - scmd_printk(KERN_INFO, cmd, ""); 1413 + scmd_printk(KERN_INFO, cmd, " "); 1414 1414 scsi_show_extd_sense(sshdr.asc, sshdr.ascq); 1415 1415 } 1416 1416 EXPORT_SYMBOL(scsi_print_sense); ··· 1453 1453 1454 1454 void scsi_print_result(struct scsi_cmnd *cmd) 1455 1455 { 1456 - scmd_printk(KERN_INFO, cmd, ""); 1456 + scmd_printk(KERN_INFO, cmd, " "); 1457 1457 scsi_show_result(cmd->result); 1458 1458 } 1459 1459 EXPORT_SYMBOL(scsi_print_result);
+6
drivers/scsi/hpsa.c
··· 3231 3231 misc_fw_support = readl(&cfgtable->misc_fw_support); 3232 3232 use_doorbell = misc_fw_support & MISC_FW_DOORBELL_RESET; 3233 3233 3234 + /* The doorbell reset seems to cause lockups on some Smart 3235 + * Arrays (e.g. P410, P410i, maybe others). Until this is 3236 + * fixed or at least isolated, avoid the doorbell reset. 3237 + */ 3238 + use_doorbell = 0; 3239 + 3234 3240 rc = hpsa_controller_hard_reset(pdev, vaddr, use_doorbell); 3235 3241 if (rc) 3236 3242 goto unmap_cfgtable;
+1 -1
drivers/scsi/osd/osd_initiator.c
··· 865 865 { 866 866 _osd_req_encode_common(or, OSD_ACT_READ, obj, offset, len); 867 867 WARN_ON(or->in.bio || or->in.total_bytes); 868 - WARN_ON(1 == (bio->bi_rw & REQ_WRITE)); 868 + WARN_ON(bio->bi_rw & REQ_WRITE); 869 869 or->in.bio = bio; 870 870 or->in.total_bytes = len; 871 871 }
+15 -8
drivers/scsi/qla2xxx/qla_attr.c
··· 1838 1838 1839 1839 qla24xx_disable_vp(vha); 1840 1840 1841 + vha->flags.delete_progress = 1; 1842 + 1841 1843 fc_remove_host(vha->host); 1842 1844 1843 1845 scsi_remove_host(vha->host); 1844 1846 1845 - qla2x00_free_fcports(vha); 1847 + if (vha->timer_active) { 1848 + qla2x00_vp_stop_timer(vha); 1849 + DEBUG15(printk(KERN_INFO "scsi(%ld): timer for the vport[%d]" 1850 + " = %p has stopped\n", vha->host_no, vha->vp_idx, vha)); 1851 + } 1846 1852 1847 1853 qla24xx_deallocate_vp_id(vha); 1854 + 1855 + /* No pending activities shall be there on the vha now */ 1856 + DEBUG(msleep(random32()%10)); /* Just to see if something falls on 1857 + * the net we have placed below */ 1858 + 1859 + BUG_ON(atomic_read(&vha->vref_count)); 1860 + 1861 + qla2x00_free_fcports(vha); 1848 1862 1849 1863 mutex_lock(&ha->vport_lock); 1850 1864 ha->cur_vport_count--; 1851 1865 clear_bit(vha->vp_idx, ha->vp_idx_map); 1852 1866 mutex_unlock(&ha->vport_lock); 1853 - 1854 - if (vha->timer_active) { 1855 - qla2x00_vp_stop_timer(vha); 1856 - DEBUG15(printk ("scsi(%ld): timer for the vport[%d] = %p " 1857 - "has stopped\n", 1858 - vha->host_no, vha->vp_idx, vha)); 1859 - } 1860 1867 1861 1868 if (vha->req->id && !ha->flags.cpu_affinity_enabled) { 1862 1869 if (qla25xx_delete_req_que(vha, vha->req) != QLA_SUCCESS)
-2
drivers/scsi/qla2xxx/qla_dbg.h
··· 29 29 /* #define QL_DEBUG_LEVEL_17 */ /* Output EEH trace messages */ 30 30 /* #define QL_DEBUG_LEVEL_18 */ /* Output T10 CRC trace messages */ 31 31 32 - /* #define QL_PRINTK_BUF */ /* Captures printk to buffer */ 33 - 34 32 /* 35 33 * Macros use for debugging the driver. 36 34 */
+20
drivers/scsi/qla2xxx/qla_def.h
··· 2641 2641 #define MBX_UPDATE_FLASH_ACTIVE 3 2642 2642 2643 2643 struct mutex vport_lock; /* Virtual port synchronization */ 2644 + spinlock_t vport_slock; /* order is hardware_lock, then vport_slock */ 2644 2645 struct completion mbx_cmd_comp; /* Serialize mbx access */ 2645 2646 struct completion mbx_intr_comp; /* Used for completion notification */ 2646 2647 struct completion dcbx_comp; /* For set port config notification */ ··· 2829 2828 uint32_t management_server_logged_in :1; 2830 2829 uint32_t process_response_queue :1; 2831 2830 uint32_t difdix_supported:1; 2831 + uint32_t delete_progress:1; 2832 2832 } flags; 2833 2833 2834 2834 atomic_t loop_state; ··· 2924 2922 struct req_que *req; 2925 2923 int fw_heartbeat_counter; 2926 2924 int seconds_since_last_heartbeat; 2925 + 2926 + atomic_t vref_count; 2927 2927 } scsi_qla_host_t; 2928 2928 2929 2929 /* ··· 2935 2931 (test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) || \ 2936 2932 test_bit(LOOP_RESYNC_NEEDED, &ha->dpc_flags) || \ 2937 2933 atomic_read(&ha->loop_state) == LOOP_DOWN) 2934 + 2935 + #define QLA_VHA_MARK_BUSY(__vha, __bail) do { \ 2936 + atomic_inc(&__vha->vref_count); \ 2937 + mb(); \ 2938 + if (__vha->flags.delete_progress) { \ 2939 + atomic_dec(&__vha->vref_count); \ 2940 + __bail = 1; \ 2941 + } else { \ 2942 + __bail = 0; \ 2943 + } \ 2944 + } while (0) 2945 + 2946 + #define QLA_VHA_MARK_NOT_BUSY(__vha) do { \ 2947 + atomic_dec(&__vha->vref_count); \ 2948 + } while (0) 2949 + 2938 2950 2939 2951 #define qla_printk(level, ha, format, arg...) \ 2940 2952 dev_printk(level , &((ha)->pdev->dev) , format , ## arg)
+81 -13
drivers/scsi/qla2xxx/qla_init.c
··· 69 69 { 70 70 struct srb_ctx *ctx = sp->ctx; 71 71 struct srb_iocb *iocb = ctx->u.iocb_cmd; 72 + struct scsi_qla_host *vha = sp->fcport->vha; 72 73 73 74 del_timer_sync(&iocb->timer); 74 75 kfree(iocb); 75 76 kfree(ctx); 76 77 mempool_free(sp, sp->fcport->vha->hw->srb_mempool); 78 + 79 + QLA_VHA_MARK_NOT_BUSY(vha); 77 80 } 78 81 79 82 inline srb_t * 80 83 qla2x00_get_ctx_sp(scsi_qla_host_t *vha, fc_port_t *fcport, size_t size, 81 84 unsigned long tmo) 82 85 { 83 - srb_t *sp; 86 + srb_t *sp = NULL; 84 87 struct qla_hw_data *ha = vha->hw; 85 88 struct srb_ctx *ctx; 86 89 struct srb_iocb *iocb; 90 + uint8_t bail; 91 + 92 + QLA_VHA_MARK_BUSY(vha, bail); 93 + if (bail) 94 + return NULL; 87 95 88 96 sp = mempool_alloc(ha->srb_mempool, GFP_KERNEL); 89 97 if (!sp) ··· 124 116 iocb->timer.function = qla2x00_ctx_sp_timeout; 125 117 add_timer(&iocb->timer); 126 118 done: 119 + if (!sp) 120 + QLA_VHA_MARK_NOT_BUSY(vha); 127 121 return sp; 128 122 } 129 123 ··· 1787 1777 qla2x00_init_response_q_entries(rsp); 1788 1778 } 1789 1779 1780 + spin_lock_irqsave(&ha->vport_slock, flags); 1790 1781 /* Clear RSCN queue. */ 1791 1782 list_for_each_entry(vp, &ha->vp_list, list) { 1792 1783 vp->rscn_in_ptr = 0; 1793 1784 vp->rscn_out_ptr = 0; 1794 1785 } 1786 + 1787 + spin_unlock_irqrestore(&ha->vport_slock, flags); 1788 + 1795 1789 ha->isp_ops->config_rings(vha); 1796 1790 1797 1791 spin_unlock_irqrestore(&ha->hardware_lock, flags); ··· 3232 3218 /* Bypass virtual ports of the same host. */ 3233 3219 found = 0; 3234 3220 if (ha->num_vhosts) { 3221 + unsigned long flags; 3222 + 3223 + spin_lock_irqsave(&ha->vport_slock, flags); 3235 3224 list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) { 3236 3225 if (new_fcport->d_id.b24 == vp->d_id.b24) { 3237 3226 found = 1; 3238 3227 break; 3239 3228 } 3240 3229 } 3230 + spin_unlock_irqrestore(&ha->vport_slock, flags); 3231 + 3241 3232 if (found) 3242 3233 continue; 3243 3234 } ··· 3362 3343 struct qla_hw_data *ha = vha->hw; 3363 3344 struct scsi_qla_host *vp; 3364 3345 struct scsi_qla_host *tvp; 3346 + unsigned long flags = 0; 3365 3347 3366 3348 rval = QLA_SUCCESS; 3367 3349 ··· 3387 3367 /* Check for loop ID being already in use. */ 3388 3368 found = 0; 3389 3369 fcport = NULL; 3370 + 3371 + spin_lock_irqsave(&ha->vport_slock, flags); 3390 3372 list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) { 3391 3373 list_for_each_entry(fcport, &vp->vp_fcports, list) { 3392 3374 if (fcport->loop_id == dev->loop_id && ··· 3401 3379 if (found) 3402 3380 break; 3403 3381 } 3382 + spin_unlock_irqrestore(&ha->vport_slock, flags); 3404 3383 3405 3384 /* If not in use then it is free to use. */ 3406 3385 if (!found) { ··· 3814 3791 qla2x00_update_fcports(scsi_qla_host_t *base_vha) 3815 3792 { 3816 3793 fc_port_t *fcport; 3817 - struct scsi_qla_host *tvp, *vha; 3794 + struct scsi_qla_host *vha; 3795 + struct qla_hw_data *ha = base_vha->hw; 3796 + unsigned long flags; 3818 3797 3798 + spin_lock_irqsave(&ha->vport_slock, flags); 3819 3799 /* Go with deferred removal of rport references. */ 3820 - list_for_each_entry_safe(vha, tvp, &base_vha->hw->vp_list, list) 3821 - list_for_each_entry(fcport, &vha->vp_fcports, list) 3800 + list_for_each_entry(vha, &base_vha->hw->vp_list, list) { 3801 + atomic_inc(&vha->vref_count); 3802 + list_for_each_entry(fcport, &vha->vp_fcports, list) { 3822 3803 if (fcport && fcport->drport && 3823 - atomic_read(&fcport->state) != FCS_UNCONFIGURED) 3804 + atomic_read(&fcport->state) != FCS_UNCONFIGURED) { 3805 + spin_unlock_irqrestore(&ha->vport_slock, flags); 3806 + 3824 3807 qla2x00_rport_del(fcport); 3808 + 3809 + spin_lock_irqsave(&ha->vport_slock, flags); 3810 + } 3811 + } 3812 + atomic_dec(&vha->vref_count); 3813 + } 3814 + spin_unlock_irqrestore(&ha->vport_slock, flags); 3825 3815 } 3826 3816 3827 3817 void ··· 3842 3806 { 3843 3807 struct qla_hw_data *ha = vha->hw; 3844 3808 struct scsi_qla_host *vp, *base_vha = pci_get_drvdata(ha->pdev); 3845 - struct scsi_qla_host *tvp; 3809 + unsigned long flags; 3846 3810 3847 3811 vha->flags.online = 0; 3848 3812 ha->flags.chip_reset_done = 0; ··· 3860 3824 if (atomic_read(&vha->loop_state) != LOOP_DOWN) { 3861 3825 atomic_set(&vha->loop_state, LOOP_DOWN); 3862 3826 qla2x00_mark_all_devices_lost(vha, 0); 3863 - list_for_each_entry_safe(vp, tvp, &base_vha->hw->vp_list, list) 3827 + 3828 + spin_lock_irqsave(&ha->vport_slock, flags); 3829 + list_for_each_entry(vp, &base_vha->hw->vp_list, list) { 3830 + atomic_inc(&vp->vref_count); 3831 + spin_unlock_irqrestore(&ha->vport_slock, flags); 3832 + 3864 3833 qla2x00_mark_all_devices_lost(vp, 0); 3834 + 3835 + spin_lock_irqsave(&ha->vport_slock, flags); 3836 + atomic_dec(&vp->vref_count); 3837 + } 3838 + spin_unlock_irqrestore(&ha->vport_slock, flags); 3865 3839 } else { 3866 3840 if (!atomic_read(&vha->loop_down_timer)) 3867 3841 atomic_set(&vha->loop_down_timer, ··· 3908 3862 uint8_t status = 0; 3909 3863 struct qla_hw_data *ha = vha->hw; 3910 3864 struct scsi_qla_host *vp; 3911 - struct scsi_qla_host *tvp; 3912 3865 struct req_que *req = ha->req_q_map[0]; 3866 + unsigned long flags; 3913 3867 3914 3868 if (vha->flags.online) { 3915 3869 qla2x00_abort_isp_cleanup(vha); ··· 4016 3970 DEBUG(printk(KERN_INFO 4017 3971 "qla2x00_abort_isp(%ld): succeeded.\n", 4018 3972 vha->host_no)); 4019 - list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) { 4020 - if (vp->vp_idx) 3973 + 3974 + spin_lock_irqsave(&ha->vport_slock, flags); 3975 + list_for_each_entry(vp, &ha->vp_list, list) { 3976 + if (vp->vp_idx) { 3977 + atomic_inc(&vp->vref_count); 3978 + spin_unlock_irqrestore(&ha->vport_slock, flags); 3979 + 4021 3980 qla2x00_vp_abort_isp(vp); 3981 + 3982 + spin_lock_irqsave(&ha->vport_slock, flags); 3983 + atomic_dec(&vp->vref_count); 3984 + } 4022 3985 } 3986 + spin_unlock_irqrestore(&ha->vport_slock, flags); 3987 + 4023 3988 } else { 4024 3989 qla_printk(KERN_INFO, ha, 4025 3990 "qla2x00_abort_isp: **** FAILED ****\n"); ··· 5242 5185 struct req_que *req = ha->req_q_map[0]; 5243 5186 struct rsp_que *rsp = ha->rsp_q_map[0]; 5244 5187 struct scsi_qla_host *vp; 5245 - struct scsi_qla_host *tvp; 5188 + unsigned long flags; 5246 5189 5247 5190 status = qla2x00_init_rings(vha); 5248 5191 if (!status) { ··· 5329 5272 DEBUG(printk(KERN_INFO 5330 5273 "qla82xx_restart_isp(%ld): succeeded.\n", 5331 5274 vha->host_no)); 5332 - list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) { 5333 - if (vp->vp_idx) 5275 + 5276 + spin_lock_irqsave(&ha->vport_slock, flags); 5277 + list_for_each_entry(vp, &ha->vp_list, list) { 5278 + if (vp->vp_idx) { 5279 + atomic_inc(&vp->vref_count); 5280 + spin_unlock_irqrestore(&ha->vport_slock, flags); 5281 + 5334 5282 qla2x00_vp_abort_isp(vp); 5283 + 5284 + spin_lock_irqsave(&ha->vport_slock, flags); 5285 + atomic_dec(&vp->vref_count); 5286 + } 5335 5287 } 5288 + spin_unlock_irqrestore(&ha->vport_slock, flags); 5289 + 5336 5290 } else { 5337 5291 qla_printk(KERN_INFO, ha, 5338 5292 "qla82xx_restart_isp: **** FAILED ****\n");
+4 -3
drivers/scsi/qla2xxx/qla_isr.c
··· 1706 1706 cp->result = DID_ERROR << 16; 1707 1707 break; 1708 1708 } 1709 - } else if (!lscsi_status) { 1709 + } else { 1710 1710 DEBUG2(qla_printk(KERN_INFO, ha, 1711 1711 "scsi(%ld:%d:%d) Dropped frame(s) detected (0x%x " 1712 1712 "of 0x%x bytes).\n", vha->host_no, cp->device->id, 1713 1713 cp->device->lun, resid, scsi_bufflen(cp))); 1714 1714 1715 - cp->result = DID_ERROR << 16; 1716 - break; 1715 + cp->result = DID_ERROR << 16 | lscsi_status; 1716 + goto check_scsi_status; 1717 1717 } 1718 1718 1719 1719 cp->result = DID_OK << 16 | lscsi_status; 1720 1720 logit = 0; 1721 1721 1722 + check_scsi_status: 1722 1723 /* 1723 1724 * Check to see if SCSI Status is non zero. If so report SCSI 1724 1725 * Status.
+5 -2
drivers/scsi/qla2xxx/qla_mbx.c
··· 2913 2913 uint16_t stat = le16_to_cpu(rptid_entry->vp_idx); 2914 2914 struct qla_hw_data *ha = vha->hw; 2915 2915 scsi_qla_host_t *vp; 2916 - scsi_qla_host_t *tvp; 2916 + unsigned long flags; 2917 2917 2918 2918 if (rptid_entry->entry_status != 0) 2919 2919 return; ··· 2945 2945 return; 2946 2946 } 2947 2947 2948 - list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) 2948 + spin_lock_irqsave(&ha->vport_slock, flags); 2949 + list_for_each_entry(vp, &ha->vp_list, list) 2949 2950 if (vp_idx == vp->vp_idx) 2950 2951 break; 2952 + spin_unlock_irqrestore(&ha->vport_slock, flags); 2953 + 2951 2954 if (!vp) 2952 2955 return; 2953 2956
+60 -8
drivers/scsi/qla2xxx/qla_mid.c
··· 30 30 { 31 31 uint32_t vp_id; 32 32 struct qla_hw_data *ha = vha->hw; 33 + unsigned long flags; 33 34 34 35 /* Find an empty slot and assign an vp_id */ 35 36 mutex_lock(&ha->vport_lock); ··· 45 44 set_bit(vp_id, ha->vp_idx_map); 46 45 ha->num_vhosts++; 47 46 vha->vp_idx = vp_id; 47 + 48 + spin_lock_irqsave(&ha->vport_slock, flags); 48 49 list_add_tail(&vha->list, &ha->vp_list); 50 + spin_unlock_irqrestore(&ha->vport_slock, flags); 51 + 49 52 mutex_unlock(&ha->vport_lock); 50 53 return vp_id; 51 54 } ··· 59 54 { 60 55 uint16_t vp_id; 61 56 struct qla_hw_data *ha = vha->hw; 57 + unsigned long flags = 0; 62 58 63 59 mutex_lock(&ha->vport_lock); 60 + /* 61 + * Wait for all pending activities to finish before removing vport from 62 + * the list. 63 + * Lock needs to be held for safe removal from the list (it 64 + * ensures no active vp_list traversal while the vport is removed 65 + * from the queue) 66 + */ 67 + spin_lock_irqsave(&ha->vport_slock, flags); 68 + while (atomic_read(&vha->vref_count)) { 69 + spin_unlock_irqrestore(&ha->vport_slock, flags); 70 + 71 + msleep(500); 72 + 73 + spin_lock_irqsave(&ha->vport_slock, flags); 74 + } 75 + list_del(&vha->list); 76 + spin_unlock_irqrestore(&ha->vport_slock, flags); 77 + 64 78 vp_id = vha->vp_idx; 65 79 ha->num_vhosts--; 66 80 clear_bit(vp_id, ha->vp_idx_map); 67 - list_del(&vha->list); 81 + 68 82 mutex_unlock(&ha->vport_lock); 69 83 } 70 84 ··· 92 68 { 93 69 scsi_qla_host_t *vha; 94 70 struct scsi_qla_host *tvha; 71 + unsigned long flags; 95 72 73 + spin_lock_irqsave(&ha->vport_slock, flags); 96 74 /* Locate matching device in database. */ 97 75 list_for_each_entry_safe(vha, tvha, &ha->vp_list, list) { 98 - if (!memcmp(port_name, vha->port_name, WWN_SIZE)) 76 + if (!memcmp(port_name, vha->port_name, WWN_SIZE)) { 77 + spin_unlock_irqrestore(&ha->vport_slock, flags); 99 78 return vha; 79 + } 100 80 } 81 + spin_unlock_irqrestore(&ha->vport_slock, flags); 101 82 return NULL; 102 83 } 103 84 ··· 122 93 static void 123 94 qla2x00_mark_vp_devices_dead(scsi_qla_host_t *vha) 124 95 { 96 + /* 97 + * !!! NOTE !!! 98 + * This function, if called in contexts other than vp create, disable 99 + * or delete, please make sure this is synchronized with the 100 + * delete thread. 101 + */ 125 102 fc_port_t *fcport; 126 103 127 104 list_for_each_entry(fcport, &vha->vp_fcports, list) { ··· 135 100 "loop_id=0x%04x :%x\n", 136 101 vha->host_no, fcport->loop_id, fcport->vp_idx)); 137 102 138 - atomic_set(&fcport->state, FCS_DEVICE_DEAD); 139 103 qla2x00_mark_device_lost(vha, fcport, 0, 0); 140 104 atomic_set(&fcport->state, FCS_UNCONFIGURED); 141 105 } ··· 228 194 void 229 195 qla2x00_alert_all_vps(struct rsp_que *rsp, uint16_t *mb) 230 196 { 231 - scsi_qla_host_t *vha, *tvha; 197 + scsi_qla_host_t *vha; 232 198 struct qla_hw_data *ha = rsp->hw; 233 199 int i = 0; 200 + unsigned long flags; 234 201 235 - list_for_each_entry_safe(vha, tvha, &ha->vp_list, list) { 202 + spin_lock_irqsave(&ha->vport_slock, flags); 203 + list_for_each_entry(vha, &ha->vp_list, list) { 236 204 if (vha->vp_idx) { 205 + atomic_inc(&vha->vref_count); 206 + spin_unlock_irqrestore(&ha->vport_slock, flags); 207 + 237 208 switch (mb[0]) { 238 209 case MBA_LIP_OCCURRED: 239 210 case MBA_LOOP_UP: ··· 254 215 qla2x00_async_event(vha, rsp, mb); 255 216 break; 256 217 } 218 + 219 + spin_lock_irqsave(&ha->vport_slock, flags); 220 + atomic_dec(&vha->vref_count); 257 221 } 258 222 i++; 259 223 } 224 + spin_unlock_irqrestore(&ha->vport_slock, flags); 260 225 } 261 226 262 227 int ··· 340 297 int ret; 341 298 struct qla_hw_data *ha = vha->hw; 342 299 scsi_qla_host_t *vp; 343 - struct scsi_qla_host *tvp; 300 + unsigned long flags = 0; 344 301 345 302 if (vha->vp_idx) 346 303 return; ··· 352 309 if (!(ha->current_topology & ISP_CFG_F)) 353 310 return; 354 311 355 - list_for_each_entry_safe(vp, tvp, &ha->vp_list, list) { 356 - if (vp->vp_idx) 312 + spin_lock_irqsave(&ha->vport_slock, flags); 313 + list_for_each_entry(vp, &ha->vp_list, list) { 314 + if (vp->vp_idx) { 315 + atomic_inc(&vp->vref_count); 316 + spin_unlock_irqrestore(&ha->vport_slock, flags); 317 + 357 318 ret = qla2x00_do_dpc_vp(vp); 319 + 320 + spin_lock_irqsave(&ha->vport_slock, flags); 321 + atomic_dec(&vp->vref_count); 322 + } 358 323 } 324 + spin_unlock_irqrestore(&ha->vport_slock, flags); 359 325 } 360 326 361 327 int
+27 -9
drivers/scsi/qla2xxx/qla_nx.c
··· 2672 2672 sufficient_dsds: 2673 2673 req_cnt = 1; 2674 2674 2675 + if (req->cnt < (req_cnt + 2)) { 2676 + cnt = (uint16_t)RD_REG_DWORD_RELAXED( 2677 + &reg->req_q_out[0]); 2678 + if (req->ring_index < cnt) 2679 + req->cnt = cnt - req->ring_index; 2680 + else 2681 + req->cnt = req->length - 2682 + (req->ring_index - cnt); 2683 + } 2684 + 2685 + if (req->cnt < (req_cnt + 2)) 2686 + goto queuing_error; 2687 + 2675 2688 ctx = sp->ctx = mempool_alloc(ha->ctx_mempool, GFP_ATOMIC); 2676 2689 if (!sp->ctx) { 2677 2690 DEBUG(printk(KERN_INFO ··· 3320 3307 set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); 3321 3308 } 3322 3309 qla2xxx_wake_dpc(vha); 3310 + ha->flags.fw_hung = 1; 3323 3311 if (ha->flags.mbox_busy) { 3324 - ha->flags.fw_hung = 1; 3325 3312 ha->flags.mbox_int = 1; 3326 3313 DEBUG2(qla_printk(KERN_ERR, ha, 3327 - "Due to fw hung, doing premature " 3328 - "completion of mbx command\n")); 3329 - complete(&ha->mbx_intr_comp); 3314 + "Due to fw hung, doing premature " 3315 + "completion of mbx command\n")); 3316 + if (test_bit(MBX_INTR_WAIT, 3317 + &ha->mbx_cmd_flags)) 3318 + complete(&ha->mbx_intr_comp); 3330 3319 } 3331 3320 } 3332 - } 3321 + } else 3322 + vha->seconds_since_last_heartbeat = 0; 3333 3323 vha->fw_heartbeat_counter = fw_heartbeat_counter; 3334 3324 } 3335 3325 ··· 3434 3418 "%s(): Adapter reset needed!\n", __func__); 3435 3419 set_bit(ISP_ABORT_NEEDED, &vha->dpc_flags); 3436 3420 qla2xxx_wake_dpc(vha); 3421 + ha->flags.fw_hung = 1; 3437 3422 if (ha->flags.mbox_busy) { 3438 - ha->flags.fw_hung = 1; 3439 3423 ha->flags.mbox_int = 1; 3440 3424 DEBUG2(qla_printk(KERN_ERR, ha, 3441 - "Need reset, doing premature " 3442 - "completion of mbx command\n")); 3443 - complete(&ha->mbx_intr_comp); 3425 + "Need reset, doing premature " 3426 + "completion of mbx command\n")); 3427 + if (test_bit(MBX_INTR_WAIT, 3428 + &ha->mbx_cmd_flags)) 3429 + complete(&ha->mbx_intr_comp); 3444 3430 } 3445 3431 } else { 3446 3432 qla82xx_check_fw_alive(vha);
+26 -4
drivers/scsi/qla2xxx/qla_os.c
··· 2341 2341 static void 2342 2342 qla2x00_remove_one(struct pci_dev *pdev) 2343 2343 { 2344 - scsi_qla_host_t *base_vha, *vha, *temp; 2344 + scsi_qla_host_t *base_vha, *vha; 2345 2345 struct qla_hw_data *ha; 2346 + unsigned long flags; 2346 2347 2347 2348 base_vha = pci_get_drvdata(pdev); 2348 2349 ha = base_vha->hw; 2349 2350 2350 - list_for_each_entry_safe(vha, temp, &ha->vp_list, list) { 2351 - if (vha && vha->fc_vport) 2351 + spin_lock_irqsave(&ha->vport_slock, flags); 2352 + list_for_each_entry(vha, &ha->vp_list, list) { 2353 + atomic_inc(&vha->vref_count); 2354 + 2355 + if (vha && vha->fc_vport) { 2356 + spin_unlock_irqrestore(&ha->vport_slock, flags); 2357 + 2352 2358 fc_vport_terminate(vha->fc_vport); 2359 + 2360 + spin_lock_irqsave(&ha->vport_slock, flags); 2361 + } 2362 + 2363 + atomic_dec(&vha->vref_count); 2353 2364 } 2365 + spin_unlock_irqrestore(&ha->vport_slock, flags); 2354 2366 2355 2367 set_bit(UNLOADING, &base_vha->dpc_flags); 2356 2368 ··· 2987 2975 qla2x00_alloc_work(struct scsi_qla_host *vha, enum qla_work_type type) 2988 2976 { 2989 2977 struct qla_work_evt *e; 2978 + uint8_t bail; 2979 + 2980 + QLA_VHA_MARK_BUSY(vha, bail); 2981 + if (bail) 2982 + return NULL; 2990 2983 2991 2984 e = kzalloc(sizeof(struct qla_work_evt), GFP_ATOMIC); 2992 - if (!e) 2985 + if (!e) { 2986 + QLA_VHA_MARK_NOT_BUSY(vha); 2993 2987 return NULL; 2988 + } 2994 2989 2995 2990 INIT_LIST_HEAD(&e->list); 2996 2991 e->type = type; ··· 3154 3135 } 3155 3136 if (e->flags & QLA_EVT_FLAG_FREE) 3156 3137 kfree(e); 3138 + 3139 + /* For each work completed decrement vha ref count */ 3140 + QLA_VHA_MARK_NOT_BUSY(vha); 3157 3141 } 3158 3142 } 3159 3143
+2 -2
drivers/scsi/qla2xxx/qla_version.h
··· 7 7 /* 8 8 * Driver version 9 9 */ 10 - #define QLA2XXX_VERSION "8.03.03-k0" 10 + #define QLA2XXX_VERSION "8.03.04-k0" 11 11 12 12 #define QLA_DRIVER_MAJOR_VER 8 13 13 #define QLA_DRIVER_MINOR_VER 3 14 - #define QLA_DRIVER_PATCH_VER 3 14 + #define QLA_DRIVER_PATCH_VER 4 15 15 #define QLA_DRIVER_BETA_VER 0
+1 -1
drivers/scsi/scsi_lib.c
··· 1011 1011 1012 1012 err_exit: 1013 1013 scsi_release_buffers(cmd); 1014 - scsi_put_command(cmd); 1015 1014 cmd->request->special = NULL; 1015 + scsi_put_command(cmd); 1016 1016 return error; 1017 1017 } 1018 1018 EXPORT_SYMBOL(scsi_init_io);
+4 -4
drivers/scsi/sd.c
··· 870 870 871 871 SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, "sd_release\n")); 872 872 873 - if (atomic_dec_return(&sdkp->openers) && sdev->removable) { 873 + if (atomic_dec_return(&sdkp->openers) == 0 && sdev->removable) { 874 874 if (scsi_block_when_processing_errors(sdev)) 875 875 scsi_set_medium_removal(sdev, SCSI_REMOVAL_ALLOW); 876 876 } ··· 2625 2625 static void sd_print_sense_hdr(struct scsi_disk *sdkp, 2626 2626 struct scsi_sense_hdr *sshdr) 2627 2627 { 2628 - sd_printk(KERN_INFO, sdkp, ""); 2628 + sd_printk(KERN_INFO, sdkp, " "); 2629 2629 scsi_show_sense_hdr(sshdr); 2630 - sd_printk(KERN_INFO, sdkp, ""); 2630 + sd_printk(KERN_INFO, sdkp, " "); 2631 2631 scsi_show_extd_sense(sshdr->asc, sshdr->ascq); 2632 2632 } 2633 2633 2634 2634 static void sd_print_result(struct scsi_disk *sdkp, int result) 2635 2635 { 2636 - sd_printk(KERN_INFO, sdkp, ""); 2636 + sd_printk(KERN_INFO, sdkp, " "); 2637 2637 scsi_show_result(result); 2638 2638 } 2639 2639
+4 -6
drivers/scsi/sym53c8xx_2/sym_hipd.c
··· 72 72 73 73 static void sym_print_msg(struct sym_ccb *cp, char *label, u_char *msg) 74 74 { 75 - if (label) 76 - sym_print_addr(cp->cmd, "%s: ", label); 77 - else 78 - sym_print_addr(cp->cmd, ""); 75 + sym_print_addr(cp->cmd, "%s: ", label); 79 76 80 77 spi_print_msg(msg); 81 78 printf("\n"); ··· 4555 4558 switch (np->msgin [2]) { 4556 4559 case M_X_MODIFY_DP: 4557 4560 if (DEBUG_FLAGS & DEBUG_POINTER) 4558 - sym_print_msg(cp, NULL, np->msgin); 4561 + sym_print_msg(cp, "extended msg ", 4562 + np->msgin); 4559 4563 tmp = (np->msgin[3]<<24) + (np->msgin[4]<<16) + 4560 4564 (np->msgin[5]<<8) + (np->msgin[6]); 4561 4565 sym_modify_dp(np, tp, cp, tmp); ··· 4583 4585 */ 4584 4586 case M_IGN_RESIDUE: 4585 4587 if (DEBUG_FLAGS & DEBUG_POINTER) 4586 - sym_print_msg(cp, NULL, np->msgin); 4588 + sym_print_msg(cp, "1 or 2 byte ", np->msgin); 4587 4589 if (cp->host_flags & HF_SENSE) 4588 4590 OUTL_DSP(np, SCRIPTA_BA(np, clrack)); 4589 4591 else