|
@@ -7719,9 +7719,12 @@ fail_qid_map:
|
|
|
|
|
|
int qla2xxx_delete_qpair(struct scsi_qla_host *vha, struct qla_qpair *qpair)
|
|
int qla2xxx_delete_qpair(struct scsi_qla_host *vha, struct qla_qpair *qpair)
|
|
{
|
|
{
|
|
- int ret;
|
|
|
|
|
|
+ int ret = QLA_FUNCTION_FAILED;
|
|
struct qla_hw_data *ha = qpair->hw;
|
|
struct qla_hw_data *ha = qpair->hw;
|
|
|
|
|
|
|
|
+ if (!vha->flags.qpairs_req_created && !vha->flags.qpairs_rsp_created)
|
|
|
|
+ goto fail;
|
|
|
|
+
|
|
qpair->delete_in_progress = 1;
|
|
qpair->delete_in_progress = 1;
|
|
while (atomic_read(&qpair->ref_count))
|
|
while (atomic_read(&qpair->ref_count))
|
|
msleep(500);
|
|
msleep(500);
|
|
@@ -7738,8 +7741,11 @@ int qla2xxx_delete_qpair(struct scsi_qla_host *vha, struct qla_qpair *qpair)
|
|
clear_bit(qpair->id, ha->qpair_qid_map);
|
|
clear_bit(qpair->id, ha->qpair_qid_map);
|
|
ha->num_qpairs--;
|
|
ha->num_qpairs--;
|
|
list_del(&qpair->qp_list_elem);
|
|
list_del(&qpair->qp_list_elem);
|
|
- if (list_empty(&vha->qp_list))
|
|
|
|
|
|
+ if (list_empty(&vha->qp_list)) {
|
|
vha->flags.qpairs_available = 0;
|
|
vha->flags.qpairs_available = 0;
|
|
|
|
+ vha->flags.qpairs_req_created = 0;
|
|
|
|
+ vha->flags.qpairs_rsp_created = 0;
|
|
|
|
+ }
|
|
mempool_destroy(qpair->srb_mempool);
|
|
mempool_destroy(qpair->srb_mempool);
|
|
kfree(qpair);
|
|
kfree(qpair);
|
|
mutex_unlock(&ha->mq_lock);
|
|
mutex_unlock(&ha->mq_lock);
|