Re: [PATCH v2] scsi: libiscsi_tcp: hold back_lock across the copy of a Data-In

From: Yehyeong Lee

Date: Fri Nov 20 2026 - 12:32:56 EST


On Fri, Nov 20, 2026 at 05:04:52PM +0000, sashiko-bot@xxxxxxxxxx wrote:
> Can iscsi_tcp_hdr_dissect() aim tcp_conn->in.datain_task and
> tcp_conn->in.segment at a task that is not in ISCSI_TASK_RUNNING?
>
> In this tree, neither iscsi_itt_to_ctask() nor iscsi_tcp_hdr_dissect()
> checks task->state == ISCSI_TASK_RUNNING.

Same answer as on v1: this follows up on the v4 series, where 3/4 makes
iscsi_itt_to_ctask() refuse ISCSI_TASK_PENDING and ISCSI_TASK_FREE and
4/4 tests ISCSI_TASK_RUNNING in the Data-In arm. On plain mainline the
PENDING case predates this patch.

> If the pending task on cxgbi is
> instead aborted or failed before cxgbi_conn_alloc_pdu() sets
> tcp_task->dd_data, cxgbi_cleanup_task() returns early without calling
> iscsi_tcp_cleanup_task(), leaving tcp_conn->in.datain_task dangling

That needs datain_task to point at a task that never went through
cxgbi_conn_alloc_pdu(). With the series above only a running task gets
there, and a task is marked running only after iscsi_prep_scsi_cmd_pdu()
has called ->alloc_pdu(), so cxgbi_cleanup_task() does reach
iscsi_tcp_cleanup_task() for it.

> Can dropping session->back_lock before segment->done() let
> iscsi_tcp_process_data_in() complete an aborted or reused task in the
> same slot?

Not something this patch changes. iscsi_tcp_process_data_in() does not
touch the scatterlist, digest case included, and a status that races
with the error handler failing the same task behaves as it did before
this patch. Answered in more detail on v1:
https://lore.kernel.org/all/20261120163948.3238659-1-yhlee@xxxxxxxxxxxxxxxxxx/

Best regards,
Yehyeong Lee