All of lore.kernel.org
 help / color / mirror / Atom feed
From: Niklas Cassel <cassel@kernel.org>
To: Damien Le Moal <dlemoal@kernel.org>
Cc: sashiko-reviews@lists.linux.dev, linux-ide@vger.kernel.org,
	linux-scsi@vger.kernel.org
Subject: Re: [PATCH v1 1/2] ata: libata-scsi: terminate deferred commands on time out
Date: Thu, 9 Jul 2026 19:27:09 +0200	[thread overview]
Message-ID: <ak_Z7Y1j7yoS_R-J@fedora> (raw)
In-Reply-To: <dcc4f558-7b6e-4193-a943-036255fc202f@kernel.org>

On Thu, Jul 09, 2026 at 06:14:08PM +0900, Damien Le Moal wrote:
> > It seems this causes the handler to fall into the 'raced completion' branch:
> > 
> > drivers/ata/libata-eh.c:ata_scsi_cmd_error_handler() {
> >     ...
> >     } else {
> >         /* Normal completion occurred after
> >          * SCSI timeout but before this point.
> >          * Successfully complete it.
> >          */
> >         scmd->retries = scmd->allowed;
> >         scsi_eh_finish_cmd(scmd, &ap->eh_done_q);
> >     }
> >     ...
> > }
> 
> And after this, scsi_eh_flush_done_q() will retry the command.
> Tested and I do not see failure of the deferred QC :)

I don't see how scsi_eh_flush_done_q() will retry the command.

Since ata_scsi_eh_timed_out() calls ata_scsi_qc_done(), which
calls scsi_done(), which calls scsi_done_internal(cmd, false),
which sets SCMD_STATE_COMPLETE, scsi_timeout() will never add
the scmd to the list of failed scmds using scsi_eh_scmd_add().

Thus, when ata_scsi_cmd_error_handler() loops though the list
of failed scmds, the scmd in question will never have been added
in the first place.

Most likely the command is retried via:
ata_scsi_qc_done() -> scsi_done() -> scsi_done_internal()

softirq -> scsi_complete() -> scsi_decide_disposition()

scsi_decide_disposition() returns ADD_TO_MLQUEUE for DID_REQUEUE,

scsi_complete() calls scsi_queue_insert(cmd, SCSI_MLQUEUE_DEVICE_BUSY);
when scsi_decide_disposition() returns ADD_DO_MLQUEUE.


Kind regards,
Niklas

  reply	other threads:[~2026-07-09 17:27 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-09  8:39 [PATCH v1 0/2] fixup handling of timeouts with deferred QCs Damien Le Moal
2026-07-09  8:39 ` [PATCH v1 1/2] ata: libata-scsi: terminate deferred commands on time out Damien Le Moal
2026-07-09  9:00   ` sashiko-bot
2026-07-09  9:14     ` Damien Le Moal
2026-07-09 17:27       ` Niklas Cassel [this message]
2026-07-09 17:56       ` Niklas Cassel
2026-07-09 18:02         ` Niklas Cassel
2026-07-10  0:00         ` Damien Le Moal
2026-07-09  8:39 ` [PATCH v1 2/2] scsi: libsas: " Damien Le Moal
2026-07-09 17:36 ` [PATCH v1 0/2] fixup handling of timeouts with deferred QCs Igor Pylypiv

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ak_Z7Y1j7yoS_R-J@fedora \
    --to=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.