Re: [PATCH 1/1] target: iscsi: Fix hang for aborted WRITE_PENDING commands
Laurence Oberman <[email protected]> Fri, 17 Jul 2026 11:08:03 -0400
| Newsgroups | org.kernel.vger.target-devel |
|---|---|
| Message-ID | <[email protected]> |
On Fri, 2026-07-17 at 16:38 +0200, Maurizio Lombardi wrote: > When a LUN_RESET aborts a WRITE command that is in the > TRANSPORT_WRITE_PENDING state, the target core sets CMD_T_ABORTED and > waits > for the frontend to finish processing. >=20 > If the initiator subsequently sends the remaining dataout PDUs, > __iscsit_check_dataout_hdr() catches the payload, stops the dataout > timer > if the sequence is final and finally dumps the data. > However, the iSCSI target doesn't trigger the completion process for > these > aborted commands. Because of this, the abort path hangs indefinitely > in > target_put_cmd_and_wait(), leading to a deadlocked target worker > thread. >=20 > Fix this by explicitly calling target_complete_cmd() when the final > dataout > PDU is received for an aborted WRITE command. target_complete_cmd() > detects > the CMD_T_ABORTED flag and cleanly routes the command into > target_abort_work, > allowing the abort completion to successfully unblock. >=20 > Signed-off-by: Maurizio Lombardi <[email protected]> > --- > =C2=A0drivers/target/iscsi/iscsi_target.c | 4 +++- > =C2=A01 file changed, 3 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/target/iscsi/iscsi_target.c > b/drivers/target/iscsi/iscsi_target.c > index 62ada3a52210..124ff269b8e7 100644 > --- a/drivers/target/iscsi/iscsi_target.c > +++ b/drivers/target/iscsi/iscsi_target.c > @@ -1533,8 +1533,10 @@ __iscsit_check_dataout_hdr(struct iscsit_conn > *conn, void *buf, > =C2=A0 */ > =C2=A0 if (se_cmd->transport_state & CMD_T_ABORTED) { > =C2=A0 if (hdr->flags & ISCSI_FLAG_CMD_FINAL && > - =C2=A0=C2=A0=C2=A0 --cmd->outstanding_r2ts < 1) > + =C2=A0=C2=A0=C2=A0 --cmd->outstanding_r2ts < 1) { > =C2=A0 iscsit_stop_dataout_timer(cmd); > + target_complete_cmd(se_cmd, > SAM_STAT_TASK_ABORTED); > + } > =C2=A0 > =C2=A0 return iscsit_dump_data_payload(conn, > payload_length, 1); > =C2=A0 } This took a long time to solve with many attempts that did not help until Maurizio's solution. This patch was tested fully at a customer to fully resolve the issue for over a week with no negative impacts. Looks good. Reviewed-by: Laurence Oberman <[email protected]>