Skip to content

Commit c98ff1d

Browse files
committed
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
2 parents aba5970 + 176ddd8 commit c98ff1d

File tree

3 files changed

+22
-31
lines changed

3 files changed

+22
-31
lines changed

drivers/scsi/libiscsi.c

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3179,9 +3179,10 @@ fail_mgmt_tasks(struct iscsi_session *session, struct iscsi_conn *conn)
31793179
}
31803180
}
31813181

3182-
static void iscsi_start_session_recovery(struct iscsi_session *session,
3183-
struct iscsi_conn *conn, int flag)
3182+
void iscsi_conn_stop(struct iscsi_cls_conn *cls_conn, int flag)
31843183
{
3184+
struct iscsi_conn *conn = cls_conn->dd_data;
3185+
struct iscsi_session *session = conn->session;
31853186
int old_stop_stage;
31863187

31873188
mutex_lock(&session->eh_mutex);
@@ -3239,27 +3240,6 @@ static void iscsi_start_session_recovery(struct iscsi_session *session,
32393240
spin_unlock_bh(&session->frwd_lock);
32403241
mutex_unlock(&session->eh_mutex);
32413242
}
3242-
3243-
void iscsi_conn_stop(struct iscsi_cls_conn *cls_conn, int flag)
3244-
{
3245-
struct iscsi_conn *conn = cls_conn->dd_data;
3246-
struct iscsi_session *session = conn->session;
3247-
3248-
switch (flag) {
3249-
case STOP_CONN_RECOVER:
3250-
cls_conn->state = ISCSI_CONN_FAILED;
3251-
break;
3252-
case STOP_CONN_TERM:
3253-
cls_conn->state = ISCSI_CONN_DOWN;
3254-
break;
3255-
default:
3256-
iscsi_conn_printk(KERN_ERR, conn,
3257-
"invalid stop flag %d\n", flag);
3258-
return;
3259-
}
3260-
3261-
iscsi_start_session_recovery(session, conn, flag);
3262-
}
32633243
EXPORT_SYMBOL_GPL(iscsi_conn_stop);
32643244

32653245
int iscsi_conn_bind(struct iscsi_cls_session *cls_session,

drivers/scsi/libsas/sas_ata.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,18 +201,17 @@ static unsigned int sas_ata_qc_issue(struct ata_queued_cmd *qc)
201201
memcpy(task->ata_task.atapi_packet, qc->cdb, qc->dev->cdb_len);
202202
task->total_xfer_len = qc->nbytes;
203203
task->num_scatter = qc->n_elem;
204+
task->data_dir = qc->dma_dir;
205+
} else if (qc->tf.protocol == ATA_PROT_NODATA) {
206+
task->data_dir = DMA_NONE;
204207
} else {
205208
for_each_sg(qc->sg, sg, qc->n_elem, si)
206209
xfer += sg_dma_len(sg);
207210

208211
task->total_xfer_len = xfer;
209212
task->num_scatter = si;
210-
}
211-
212-
if (qc->tf.protocol == ATA_PROT_NODATA)
213-
task->data_dir = DMA_NONE;
214-
else
215213
task->data_dir = qc->dma_dir;
214+
}
216215
task->scatter = qc->sg;
217216
task->ata_task.retry_count = 1;
218217
task->task_state_flags = SAS_TASK_STATE_PENDING;

drivers/scsi/scsi_transport_iscsi.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2474,10 +2474,22 @@ static void iscsi_if_stop_conn(struct iscsi_cls_conn *conn, int flag)
24742474
* it works.
24752475
*/
24762476
mutex_lock(&conn_mutex);
2477+
switch (flag) {
2478+
case STOP_CONN_RECOVER:
2479+
conn->state = ISCSI_CONN_FAILED;
2480+
break;
2481+
case STOP_CONN_TERM:
2482+
conn->state = ISCSI_CONN_DOWN;
2483+
break;
2484+
default:
2485+
iscsi_cls_conn_printk(KERN_ERR, conn,
2486+
"invalid stop flag %d\n", flag);
2487+
goto unlock;
2488+
}
2489+
24772490
conn->transport->stop_conn(conn, flag);
2478-
conn->state = ISCSI_CONN_DOWN;
2491+
unlock:
24792492
mutex_unlock(&conn_mutex);
2480-
24812493
}
24822494

24832495
static void stop_conn_work_fn(struct work_struct *work)
@@ -2968,7 +2980,7 @@ static int iscsi_if_ep_disconnect(struct iscsi_transport *transport,
29682980
mutex_lock(&conn->ep_mutex);
29692981
conn->ep = NULL;
29702982
mutex_unlock(&conn->ep_mutex);
2971-
conn->state = ISCSI_CONN_DOWN;
2983+
conn->state = ISCSI_CONN_FAILED;
29722984
}
29732985

29742986
transport->ep_disconnect(ep);

0 commit comments

Comments
 (0)