[SCSI] qla4xxx: directly call iscsi recovery functions
authorMike Christie <michaelc@cs.wisc.edu>
Thu, 31 Jan 2008 19:36:44 +0000 (13:36 -0600)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Fri, 8 Feb 2008 00:02:34 +0000 (18:02 -0600)
Qla4xxx can just call the iscsi recovery functions directly.
There is no need for userspace to do this for qla4xxx, because
we do not use the mutex to iterate over devices anymore and iscsi_block
/unblock_session can be called from interrupt context or the dpc thread.
And having userspace do this just creates uneeded headaches for qla4xxx root
situations where the session may experience problems. For example
during the kernel shutdown the scsi layer wants to send sync caches, but at
this time userspace is not up (iscsid is not running), so we cannot
recover from the problem.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Cc: David Somayajulu <david.somayajulu@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/scsi/qla4xxx/ql4_init.c
drivers/scsi/qla4xxx/ql4_os.c

index 49925f92555e8a3b485316d5963bc0dd8ef6d49f..10b3b9a620f357f0bcf91a39546a9b594451f149 100644 (file)
@@ -1306,6 +1306,7 @@ int qla4xxx_process_ddb_changed(struct scsi_qla_host *ha,
                atomic_set(&ddb_entry->relogin_timer, 0);
                clear_bit(DF_RELOGIN, &ddb_entry->flags);
                clear_bit(DF_NO_RELOGIN, &ddb_entry->flags);
+               iscsi_unblock_session(ddb_entry->sess);
                iscsi_session_event(ddb_entry->sess,
                                    ISCSI_KEVENT_CREATE_SESSION);
                /*
index 2e2b9fedffcc7c763b1f1d8f70df0faa38e27f61..a87fb9f00ac4f5b96d7a859ca6734a353dc8b4ed 100644 (file)
@@ -63,8 +63,6 @@ static int qla4xxx_sess_get_param(struct iscsi_cls_session *sess,
                                  enum iscsi_param param, char *buf);
 static int qla4xxx_host_get_param(struct Scsi_Host *shost,
                                  enum iscsi_host_param param, char *buf);
-static void qla4xxx_conn_stop(struct iscsi_cls_conn *conn, int flag);
-static int qla4xxx_conn_start(struct iscsi_cls_conn *conn);
 static void qla4xxx_recovery_timedout(struct iscsi_cls_session *session);
 
 /*
@@ -116,8 +114,6 @@ static struct iscsi_transport qla4xxx_iscsi_transport = {
        .get_conn_param         = qla4xxx_conn_get_param,
        .get_session_param      = qla4xxx_sess_get_param,
        .get_host_param         = qla4xxx_host_get_param,
-       .start_conn             = qla4xxx_conn_start,
-       .stop_conn              = qla4xxx_conn_stop,
        .session_recovery_timedout = qla4xxx_recovery_timedout,
 };
 
@@ -140,38 +136,6 @@ static void qla4xxx_recovery_timedout(struct iscsi_cls_session *session)
        queue_work(ha->dpc_thread, &ha->dpc_work);
 }
 
-static int qla4xxx_conn_start(struct iscsi_cls_conn *conn)
-{
-       struct iscsi_cls_session *session;
-       struct ddb_entry *ddb_entry;
-
-       session = iscsi_dev_to_session(conn->dev.parent);
-       ddb_entry = session->dd_data;
-
-       DEBUG2(printk("scsi%ld: %s: index [%d] starting conn\n",
-                     ddb_entry->ha->host_no, __func__,
-                     ddb_entry->fw_ddb_index));
-       iscsi_unblock_session(session);
-       return 0;
-}
-
-static void qla4xxx_conn_stop(struct iscsi_cls_conn *conn, int flag)
-{
-       struct iscsi_cls_session *session;
-       struct ddb_entry *ddb_entry;
-
-       session = iscsi_dev_to_session(conn->dev.parent);
-       ddb_entry = session->dd_data;
-
-       DEBUG2(printk("scsi%ld: %s: index [%d] stopping conn\n",
-                     ddb_entry->ha->host_no, __func__,
-                     ddb_entry->fw_ddb_index));
-       if (flag == STOP_CONN_RECOVER)
-               iscsi_block_session(session);
-       else
-               printk(KERN_ERR "iscsi: invalid stop flag %d\n", flag);
-}
-
 static int qla4xxx_host_get_param(struct Scsi_Host *shost,
                                  enum iscsi_host_param param, char *buf)
 {
@@ -308,6 +272,9 @@ int qla4xxx_add_sess(struct ddb_entry *ddb_entry)
                DEBUG2(printk(KERN_ERR "Could not add connection.\n"));
                return -ENOMEM;
        }
+
+       /* finally ready to go */
+       iscsi_unblock_session(ddb_entry->sess);
        return 0;
 }
 
@@ -364,6 +331,7 @@ void qla4xxx_mark_device_missing(struct scsi_qla_host *ha,
        DEBUG3(printk("scsi%d:%d:%d: index [%d] marked MISSING\n",
                      ha->host_no, ddb_entry->bus, ddb_entry->target,
                      ddb_entry->fw_ddb_index));
+       iscsi_block_session(ddb_entry->sess);
        iscsi_conn_error(ddb_entry->conn, ISCSI_ERR_CONN_FAILED);
 }