diff options
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_os.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_os.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index 8c80b49ac1c4..1e4bff695254 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c | |||
@@ -2341,16 +2341,28 @@ probe_out: | |||
2341 | static void | 2341 | static void |
2342 | qla2x00_remove_one(struct pci_dev *pdev) | 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 | struct qla_hw_data *ha; | 2345 | struct qla_hw_data *ha; |
2346 | unsigned long flags; | ||
2346 | 2347 | ||
2347 | base_vha = pci_get_drvdata(pdev); | 2348 | base_vha = pci_get_drvdata(pdev); |
2348 | ha = base_vha->hw; | 2349 | ha = base_vha->hw; |
2349 | 2350 | ||
2350 | list_for_each_entry_safe(vha, temp, &ha->vp_list, list) { | 2351 | spin_lock_irqsave(&ha->vport_slock, flags); |
2351 | if (vha && vha->fc_vport) | 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 | fc_vport_terminate(vha->fc_vport); | 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 | set_bit(UNLOADING, &base_vha->dpc_flags); | 2367 | set_bit(UNLOADING, &base_vha->dpc_flags); |
2356 | 2368 | ||
@@ -2975,10 +2987,17 @@ static struct qla_work_evt * | |||
2975 | qla2x00_alloc_work(struct scsi_qla_host *vha, enum qla_work_type type) | 2987 | qla2x00_alloc_work(struct scsi_qla_host *vha, enum qla_work_type type) |
2976 | { | 2988 | { |
2977 | struct qla_work_evt *e; | 2989 | struct qla_work_evt *e; |
2990 | uint8_t bail; | ||
2991 | |||
2992 | QLA_VHA_MARK_BUSY(vha, bail); | ||
2993 | if (bail) | ||
2994 | return NULL; | ||
2978 | 2995 | ||
2979 | e = kzalloc(sizeof(struct qla_work_evt), GFP_ATOMIC); | 2996 | e = kzalloc(sizeof(struct qla_work_evt), GFP_ATOMIC); |
2980 | if (!e) | 2997 | if (!e) { |
2998 | QLA_VHA_MARK_NOT_BUSY(vha); | ||
2981 | return NULL; | 2999 | return NULL; |
3000 | } | ||
2982 | 3001 | ||
2983 | INIT_LIST_HEAD(&e->list); | 3002 | INIT_LIST_HEAD(&e->list); |
2984 | e->type = type; | 3003 | e->type = type; |
@@ -3135,6 +3154,9 @@ qla2x00_do_work(struct scsi_qla_host *vha) | |||
3135 | } | 3154 | } |
3136 | if (e->flags & QLA_EVT_FLAG_FREE) | 3155 | if (e->flags & QLA_EVT_FLAG_FREE) |
3137 | kfree(e); | 3156 | kfree(e); |
3157 | |||
3158 | /* For each work completed decrement vha ref count */ | ||
3159 | QLA_VHA_MARK_NOT_BUSY(vha); | ||
3138 | } | 3160 | } |
3139 | } | 3161 | } |
3140 | 3162 | ||