Commit c98ff1d0 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi

Pull SCSI fixes from James Bottomley:
 "Two fixes: the libsas fix is for a problem that occurs when trying to
  change the cache type of an ATA device and the libiscsi one is a
  regression fix from this merge window"

* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
  scsi: libsas: Reset num_scatter if libata marks qc as NODATA
  scsi: iscsi: Fix iSCSI cls conn state
parents aba5970c 176ddd89
...@@ -3179,9 +3179,10 @@ fail_mgmt_tasks(struct iscsi_session *session, struct iscsi_conn *conn) ...@@ -3179,9 +3179,10 @@ fail_mgmt_tasks(struct iscsi_session *session, struct iscsi_conn *conn)
} }
} }
static void iscsi_start_session_recovery(struct iscsi_session *session, void iscsi_conn_stop(struct iscsi_cls_conn *cls_conn, int flag)
struct iscsi_conn *conn, int flag)
{ {
struct iscsi_conn *conn = cls_conn->dd_data;
struct iscsi_session *session = conn->session;
int old_stop_stage; int old_stop_stage;
mutex_lock(&session->eh_mutex); mutex_lock(&session->eh_mutex);
...@@ -3239,27 +3240,6 @@ static void iscsi_start_session_recovery(struct iscsi_session *session, ...@@ -3239,27 +3240,6 @@ static void iscsi_start_session_recovery(struct iscsi_session *session,
spin_unlock_bh(&session->frwd_lock); spin_unlock_bh(&session->frwd_lock);
mutex_unlock(&session->eh_mutex); mutex_unlock(&session->eh_mutex);
} }
void iscsi_conn_stop(struct iscsi_cls_conn *cls_conn, int flag)
{
struct iscsi_conn *conn = cls_conn->dd_data;
struct iscsi_session *session = conn->session;
switch (flag) {
case STOP_CONN_RECOVER:
cls_conn->state = ISCSI_CONN_FAILED;
break;
case STOP_CONN_TERM:
cls_conn->state = ISCSI_CONN_DOWN;
break;
default:
iscsi_conn_printk(KERN_ERR, conn,
"invalid stop flag %d\n", flag);
return;
}
iscsi_start_session_recovery(session, conn, flag);
}
EXPORT_SYMBOL_GPL(iscsi_conn_stop); EXPORT_SYMBOL_GPL(iscsi_conn_stop);
int iscsi_conn_bind(struct iscsi_cls_session *cls_session, int iscsi_conn_bind(struct iscsi_cls_session *cls_session,
......
...@@ -201,18 +201,17 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc) ...@@ -201,18 +201,17 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
memcpy(task->ata_task.atapi_packet, qc->cdb, qc->dev->cdb_len); memcpy(task->ata_task.atapi_packet, qc->cdb, qc->dev->cdb_len);
task->total_xfer_len = qc->nbytes; task->total_xfer_len = qc->nbytes;
task->num_scatter = qc->n_elem; task->num_scatter = qc->n_elem;
task->data_dir = qc->dma_dir;
} else if (qc->tf.protocol == ATA_PROT_NODATA) {
task->data_dir = DMA_NONE;
} else { } else {
for_each_sg(qc->sg, sg, qc->n_elem, si) for_each_sg(qc->sg, sg, qc->n_elem, si)
xfer += sg_dma_len(sg); xfer += sg_dma_len(sg);
task->total_xfer_len = xfer; task->total_xfer_len = xfer;
task->num_scatter = si; task->num_scatter = si;
}
if (qc->tf.protocol == ATA_PROT_NODATA)
task->data_dir = DMA_NONE;
else
task->data_dir = qc->dma_dir; task->data_dir = qc->dma_dir;
}
task->scatter = qc->sg; task->scatter = qc->sg;
task->ata_task.retry_count = 1; task->ata_task.retry_count = 1;
task->task_state_flags = SAS_TASK_STATE_PENDING; task->task_state_flags = SAS_TASK_STATE_PENDING;
......
...@@ -2474,10 +2474,22 @@ static void iscsi_if_stop_conn(struct iscsi_cls_conn *conn, int flag) ...@@ -2474,10 +2474,22 @@ static void iscsi_if_stop_conn(struct iscsi_cls_conn *conn, int flag)
* it works. * it works.
*/ */
mutex_lock(&conn_mutex); mutex_lock(&conn_mutex);
conn->transport->stop_conn(conn, flag); switch (flag) {
case STOP_CONN_RECOVER:
conn->state = ISCSI_CONN_FAILED;
break;
case STOP_CONN_TERM:
conn->state = ISCSI_CONN_DOWN; conn->state = ISCSI_CONN_DOWN;
mutex_unlock(&conn_mutex); break;
default:
iscsi_cls_conn_printk(KERN_ERR, conn,
"invalid stop flag %d\n", flag);
goto unlock;
}
conn->transport->stop_conn(conn, flag);
unlock:
mutex_unlock(&conn_mutex);
} }
static void stop_conn_work_fn(struct work_struct *work) static void stop_conn_work_fn(struct work_struct *work)
...@@ -2968,7 +2980,7 @@ static int iscsi_if_ep_disconnect(struct iscsi_transport *transport, ...@@ -2968,7 +2980,7 @@ static int iscsi_if_ep_disconnect(struct iscsi_transport *transport,
mutex_lock(&conn->ep_mutex); mutex_lock(&conn->ep_mutex);
conn->ep = NULL; conn->ep = NULL;
mutex_unlock(&conn->ep_mutex); mutex_unlock(&conn->ep_mutex);
conn->state = ISCSI_CONN_DOWN; conn->state = ISCSI_CONN_FAILED;
} }
transport->ep_disconnect(ep); transport->ep_disconnect(ep);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment