Linux SCSI subsystem development
 help / color / mirror / Atom feed
* [PATCH v4 0/4] scsi: libiscsi: tighten task completion
@ 2026-11-17 10:14 Yehyeong Lee
  2026-11-17 10:14 ` [PATCH v4 1/4] scsi: libiscsi: only complete a task that has been sent Yehyeong Lee
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Yehyeong Lee @ 2026-11-17 10:14 UTC (permalink / raw)
  To: lduncan, cleech, michael.christie, mkp, James.Bottomley
  Cc: linux-scsi, linux-kernel

1/4 stops the receive path from completing a management task that is still
queued or still being filled in, so a slot cannot be returned to the task
pool while the transmit path still owns it.  2/4 stops it from completing a
NOP-Out sent with RESERVED_ITT, whose single reference belongs to the
transport, so that reference cannot be dropped twice.  3/4 makes the
transmit path hold a reference before it publishes the state the other two
test, and makes the SCSI command lookup honour that state at all.  4/4
stops the receive path copying a Data-In into a command that has been
handed back.

v3 -> v4:
 - 1/4 and 2/4 are unchanged.
 - 4/4 is new.
 - 3/4 drops the two hunks that kept iscsi_xmit_task() from handing a task
   to the transport once the receive path had completed it: the early
   return in the conn->task branch, and the ISCSI_TASK_RUNNING test around
   storing the task in conn->task.  Both release the last reference to a
   task whose PDU the transport has only half sent, and for iscsi_tcp
   tcp_sw_conn->out.segment then still points into the sg list that
   scsi_done() has handed back, which the next task's
   iscsi_tcp_task_xmit() flushes first.  Mainline holds the task until the
   transport reports the PDU done, and 3/4 now leaves that alone.  The
   second hunk also re-added the test that commit 533ac412fdb4 ("scsi:
   iscsi: Remove unneeded task state check") removed, so that Fixes tag
   goes with it.
 - 3/4's SCSI lookup refuses ISCSI_TASK_FREE as well as
   ISCSI_TASK_PENDING, because iscsi_alloc_task() stores the state before
   ->sc and under frwd_lock only, so a slot being handed out can be seen
   with its new ->sc and the state it was freed with.
 - 3/4's changelog follows.

One older problem is left alone, because it is not a completion condition.
iscsi_xmit_task() still sends one Data-Out for a command the target has
answered, from conn->task and from conn->requeue alike; nothing is freed
there, because the reference is taken before the queue's one is dropped,
and skipping the send is what the two dropped hunks show to be unsafe.

3/4 needs 1/4 underneath, and is marked for stable for the same reason.
4/4 is independent of the first three.

v1 of 1/4:
  https://lore.kernel.org/all/20261113145140.282504-1-yhlee@isslab.korea.ac.kr/
v1 of 2/4:
  https://lore.kernel.org/all/20261113232322.395246-1-yhlee@isslab.korea.ac.kr/
v2:
  https://lore.kernel.org/all/20261113233938.397415-1-yhlee@isslab.korea.ac.kr/
v3:
  https://lore.kernel.org/all/20261115122122.1446791-1-yhlee@isslab.korea.ac.kr/

Best regards,
Yehyeong Lee

Yehyeong Lee (4):
  scsi: libiscsi: only complete a task that has been sent
  scsi: libiscsi: do not complete a task sent with a reserved ITT
  scsi: libiscsi: take a transmit reference before a task is published
  scsi: libiscsi_tcp: do not accept a Data-In for a finished command

 drivers/scsi/libiscsi.c     | 56 +++++++++++++++++++++++++++++++------
 drivers/scsi/libiscsi_tcp.c |  3 +-
 2 files changed, 50 insertions(+), 9 deletions(-)


base-commit: 7e1392a42ea288d70a266f6553fe06f57f8647ea
-- 
2.43.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-11-17 11:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-17 10:14 [PATCH v4 0/4] scsi: libiscsi: tighten task completion Yehyeong Lee
2026-11-17 10:14 ` [PATCH v4 1/4] scsi: libiscsi: only complete a task that has been sent Yehyeong Lee
2026-11-17 10:14 ` [PATCH v4 2/4] scsi: libiscsi: do not complete a task sent with a reserved ITT Yehyeong Lee
2026-11-17 10:14 ` [PATCH v4 3/4] scsi: libiscsi: take a transmit reference before a task is published Yehyeong Lee
2026-11-17 10:15 ` [PATCH v4 4/4] scsi: libiscsi_tcp: do not accept a Data-In for a finished command Yehyeong Lee
2026-11-17 10:40   ` sashiko-bot
2026-11-17 11:50     ` Yehyeong Lee

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox