[SCSI] qla4xxx: use iscsi class session state check ready
authorMike Christie <michaelc@cs.wisc.edu>
Thu, 31 Jan 2008 19:36:45 +0000 (13:36 -0600)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Fri, 8 Feb 2008 00:02:35 +0000 (18:02 -0600)
This has qla4xxx use the iscsi class's check ready function
in the queue command function, so all iscsi drivers return the
same error value for common problems.

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_os.c

index a87fb9f00ac4f5b96d7a859ca6734a353dc8b4ed..437d169a9814fd9f868beb9ce8004448bbd52f51 100644 (file)
@@ -398,9 +398,21 @@ static int qla4xxx_queuecommand(struct scsi_cmnd *cmd,
 {
        struct scsi_qla_host *ha = to_qla_host(cmd->device->host);
        struct ddb_entry *ddb_entry = cmd->device->hostdata;
+       struct iscsi_cls_session *sess = ddb_entry->sess;
        struct srb *srb;
        int rval;
 
+       if (!sess) {
+               cmd->result = DID_IMM_RETRY << 16;
+               goto qc_fail_command;
+       }
+
+       rval = iscsi_session_chkready(sess);
+       if (rval) {
+               cmd->result = rval;
+               goto qc_fail_command;
+       }
+
        if (atomic_read(&ddb_entry->state) != DDB_STATE_ONLINE) {
                if (atomic_read(&ddb_entry->state) == DDB_STATE_DEAD) {
                        cmd->result = DID_NO_CONNECT << 16;