Merge tag 'scsi-misc' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
[linux-2.6-microblaze.git] / drivers / scsi / qla2xxx / qla_target.c
index 2d445bd..a27a625 100644 (file)
@@ -1111,6 +1111,8 @@ void qlt_free_session_done(struct work_struct *work)
        spin_unlock_irqrestore(&ha->tgt.sess_lock, flags);
        sess->free_pending = 0;
 
+       qla2x00_dfs_remove_rport(vha, sess);
+
        ql_dbg(ql_dbg_disc, vha, 0xf001,
            "Unregistration of sess %p %8phC finished fcp_cnt %d\n",
                sess, sess->port_name, vha->fcport_count);
@@ -1229,14 +1231,15 @@ void qlt_schedule_sess_for_deletion(struct fc_port *sess)
        case DSC_DELETE_PEND:
                return;
        case DSC_DELETED:
-               if (tgt && tgt->tgt_stop && (tgt->sess_count == 0))
-                       wake_up_all(&tgt->waitQ);
-               if (sess->vha->fcport_count == 0)
-                       wake_up_all(&sess->vha->fcport_waitQ);
-
                if (!sess->plogi_link[QLT_PLOGI_LINK_SAME_WWN] &&
-                       !sess->plogi_link[QLT_PLOGI_LINK_CONFLICT])
+                       !sess->plogi_link[QLT_PLOGI_LINK_CONFLICT]) {
+                       if (tgt && tgt->tgt_stop && tgt->sess_count == 0)
+                               wake_up_all(&tgt->waitQ);
+
+                       if (sess->vha->fcport_count == 0)
+                               wake_up_all(&sess->vha->fcport_waitQ);
                        return;
+               }
                break;
        case DSC_UPD_FCPORT:
                /*
@@ -2025,7 +2028,7 @@ static void qlt_do_tmr_work(struct work_struct *work)
        struct qla_tgt_mgmt_cmd *mcmd =
                container_of(work, struct qla_tgt_mgmt_cmd, work);
        struct qla_hw_data *ha = mcmd->vha->hw;
-       int rc = EIO;
+       int rc;
        uint32_t tag;
        unsigned long flags;
 
@@ -3781,7 +3784,7 @@ int qlt_abort_cmd(struct qla_tgt_cmd *cmd)
                    "multiple abort. %p transport_state %x, t_state %x, "
                    "se_cmd_flags %x\n", cmd, cmd->se_cmd.transport_state,
                    cmd->se_cmd.t_state, cmd->se_cmd.se_cmd_flags);
-               return EIO;
+               return -EIO;
        }
        cmd->aborted = 1;
        cmd->trc_flags |= TRC_ABORT;
@@ -5668,7 +5671,7 @@ static int qlt_chk_unresolv_exchg(struct scsi_qla_host *vha,
                /* found existing exchange */
                qpair->retry_term_cnt++;
                if (qpair->retry_term_cnt >= 5) {
-                       rc = EIO;
+                       rc = -EIO;
                        qpair->retry_term_cnt = 0;
                        ql_log(ql_log_warn, vha, 0xffff,
                            "Unable to send ABTS Respond. Dumping firmware.\n");