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

1/3 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/3 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/3 is new: it 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.

v2 -> v3:
 - 1/3 and 2/3 are unchanged.
 - 3/3 is new.

The review of v2 1/2 raised three issues.  All three are older than this
series, which narrows two of them and leaves the third as it was, and 3/3
addresses each one:

 - the window between the ISCSI_TASK_RUNNING store in
   iscsi_prep_mgmt_task() / iscsi_prep_scsi_cmd_pdu() and iscsi_get_task()
   in iscsi_xmit_task(): the store moves into iscsi_xmit_task(), after the
   reference has been taken.  For a SCSI command that alone is not enough,
   because iscsi_itt_to_ctask() never read task->state, so a command still
   queued on conn->cmdqueue in ISCSI_TASK_PENDING could be completed by the
   receive path; that lookup now skips a task that has not been sent, the
   way 1/3 does for the management lookup.

 - iscsi_xmit_task() requeueing in conn->task a task that the receive path
   completed while frwd_lock was dropped: the requeue becomes conditional
   on the task still being ISCSI_TASK_RUNNING, read under back_lock, which
   is the test commit 533ac412fdb4 ("scsi: iscsi: Remove unneeded task
   state check") removed.  The other half of the same window - a task that
   was parked in conn->task and finished before it could be sent again - is
   dropped now instead of sent.

 - transports without ihost->workq, which call session->tt->xmit_task()
   from iscsi_send_mgmt_task() and iscsi_queuecommand() with no reference
   beyond the allocation one: both now take a transmit reference of their
   own, and both finish with a failed send inside the same back_lock
   section that tests for it, so the receive path can no longer complete
   a task whose reference the caller is about to put.
   iscsi_queuecommand() gives the command back to scsi-ml right there;
   iscsi_send_mgmt_task(), whose caller frees the task, parks it in
   ISCSI_TASK_COMPLETED, which is a state no ->cleanup_task() reads
   differently from ISCSI_TASK_RUNNING.

3/3 needs 1/3 underneath, and is marked for stable for the same reason.

v1 of 1/3:
  https://lore.kernel.org/all/20261113145140.282504-1-yhlee@isslab.korea.ac.kr/
v1 of 2/3:
  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/

Best regards,
Yehyeong Lee

Yehyeong Lee (3):
  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

 drivers/scsi/libiscsi.c | 67 +++++++++++++++++++++++++++++++++++------
 1 file changed, 58 insertions(+), 9 deletions(-)


base-commit: 7e1392a42ea288d70a266f6553fe06f57f8647ea
-- 
2.43.0


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

end of thread, other threads:[~2026-11-15 13:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-15 12:21 [PATCH v3 0/3] scsi: libiscsi: tighten task completion Yehyeong Lee
2026-11-15 12:21 ` [PATCH v3 1/3] scsi: libiscsi: only complete a task that has been sent Yehyeong Lee
2026-11-15 12:21 ` [PATCH v3 2/3] scsi: libiscsi: do not complete a task sent with a reserved ITT Yehyeong Lee
2026-11-15 12:21 ` [PATCH v3 3/3] scsi: libiscsi: take a transmit reference before a task is published Yehyeong Lee
2026-11-15 13:00   ` sashiko-bot

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