From: sashiko-bot@kernel.org
To: "Jeff Layton" <jlayton@kernel.org>
Cc: linux-scsi@vger.kernel.org
Subject: Re: [PATCH v3 11/11] scsi: mpt3sas: Time out delayed not-responding device blocks
Date: Wed, 18 Nov 2026 23:33:28 +0000 [thread overview]
Message-ID: <sashiko-outbox-222184@kernel.org> (raw)
In-Reply-To: <20261118-sas-abba-v3-11-5562d690cf61@kernel.org>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] scsi: mpt3sas: new DNR events ignored while polling in
_scsih_block_io_device()
- [Medium] scsi: mpt3sas: sticky deleted flag on sdev prevents future
device blocking
--
commit bc92a124ea93f9bf48382ebe6742a2dde2541670
Author: Jeff Layton <jlayton@kernel.org>
scsi: mpt3sas: Time out delayed not-responding device blocks
This commit adds a delayed work item to time out and release delayed
not-responding SDEV_BLOCK states after the firmware device missing delay
plus a 30-second margin, and coordinates that timeout with device readiness
polling and broadcast primitive handling.
> diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
> index 814c18289cf1c..6eb92bd4f1225 100644
> --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c
> +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c
[ ... ]
> @@ -4125,23 +4128,106 @@ _scsih_get_target_ids(struct MPT3SAS_ADAPTER *ioc, struct scsi_device *sdev,
[ ... ]
> +static bool
> +_scsih_claim_block(struct MPT3SAS_ADAPTER *ioc, struct scsi_device *sdev,
> + struct MPT3SAS_DEVICE *sas_device_priv_data,
> + unsigned int *block_seq)
> +{
> + unsigned long flags;
> + bool claimed = false;
> +
> + spin_lock_irqsave(&ioc->block_lock, flags);
> + if (sdev->hostdata == sas_device_priv_data &&
> + (sas_device_priv_data->block || sas_device_priv_data->dnr_expired)) {
> + sas_device_priv_data->block_deadline = 0;
> + sas_device_priv_data->dnr_expired = 0;
> + *block_seq = sas_device_priv_data->block_seq;
> + claimed = true;
> + }
> + spin_unlock_irqrestore(&ioc->block_lock, flags);
> + return claimed;
> +}
[ ... ]
> @@ -4149,8 +4235,15 @@ _scsih_end_poll(struct MPT3SAS_ADAPTER *ioc, struct scsi_device *sdev,
> spin_lock_irqsave(&ioc->block_lock, flags);
> if (!__scsih_get_target_ids(sdev, sas_device_priv_data, ids))
> goto out;
> + if (sas_device_priv_data->block_seq != block_seq) {
> + sdev_printk(KERN_INFO, sdev,
> + "blocked again while polled, handle(0x%04x)\n",
> + ids->handle);
> + goto out;
> + }
> if (!ready)
> sas_device_priv_data->deleted = 1;
> + /* not blocked if dnr_unblock_work released it before polling */
> if (sas_device_priv_data->block)
> _scsih_internal_device_unblock(sdev, sas_device_priv_data);
> ret = true;
[ ... ]
> @@ -4536,10 +4818,30 @@ _scsih_block_io_device(struct MPT3SAS_ADAPTER *ioc, u16 handle)
> goto next;
> if (sas_device_priv_data->sas_target->handle != handle)
> goto next;
> - if (sas_device_priv_data->block)
> + deadline = (jiffies + _scsih_dnr_block_timeout(ioc,
> + sas_device_priv_data->sas_target)) ?: 1;
> + if (sas_device_priv_data->block) {
> + /* a repeat DNR restarts the firmware's missing delay */
> + if (sas_device_priv_data->block_deadline &&
> + sas_device_priv_data->block_extends <
> + MPT3SAS_DNR_BLOCK_MAX_EXTENDS) {
> + sas_device_priv_data->block_extends++;
> + sas_device_priv_data->block_deadline = deadline;
> + __scsih_dnr_unblock_work_by(ioc, deadline);
> + }
> goto next;
> + }
[Severity: Medium]
Does _scsih_block_io_device() drop a new DELAY_NOT_RESPONDING event that
arrives while the firmware event worker is polling a still-blocked sdev?
Before polling, _scsih_ublock_io_all_device(),
_scsih_ublock_io_device_wait() and _scsih_claim_block() clear
sas_device_priv_data->block_deadline to 0 while leaving
sas_device_priv_data->block set to 1:
kworker <hardirq>
_scsih_ublock_io_device_wait()
block_deadline = 0
_scsih_claim_block()
*block_seq = priv->block_seq
_scsih_block_io_device()
if (priv->block)
if (priv->block_deadline && ...)
goto next;
_scsih_end_poll()
if (priv->block_seq != block_seq)
_scsih_internal_device_unblock() <-- unblocks or offlines during DNR
Because sas_device_priv_data->block is still 1 and block_deadline is 0,
_scsih_block_io_device() neither increments block_seq nor sets a new
block_deadline. _scsih_end_poll() then sees an unchanged block_seq and
either unblocks the non-responding device to SDEV_RUNNING or marks it
deleted and offlines it during the active device missing delay.
Also, in the second loop of _scsih_ublock_io_all_device() and
_scsih_ublock_io_device_wait(), _scsih_claim_block() is called lazily per
sdev. If an sdev whose previous block already expired (block == 0,
dnr_expired == 1) receives a new DELAY_NOT_RESPONDING block while an
earlier sdev is being polled, _scsih_claim_block() will claim that new
block, clear its block_deadline and poll it immediately.
> if (sas_device && sas_device->pend_sas_rphy_add)
> goto next;
> + /*
> + * Expiry would bring it back running without a TUR check.
> + * _scsih_ublock_io_device_wait() polls offline devices anyway.
> + * A device that failed its TUR check is marked deleted under
> + * block_lock, before it is set offline.
> + */
> + if (sdev->sdev_state == SDEV_OFFLINE ||
> + sas_device_priv_data->deleted)
> + goto next;
[Severity: Medium]
Can sas_device_priv_data->deleted remain set to 1 after an offlined sdev is
returned to SDEV_RUNNING?
When a readiness check fails, _scsih_end_poll() sets
sas_device_priv_data->deleted = 1 under ioc->block_lock before the caller
sets sdev->sdev_state to SDEV_OFFLINE. The only place that clears
sas_device_priv_data->deleted back to 0 is the first loop of
_scsih_ublock_io_device_wait(), and only when sdev->sdev_state is still
SDEV_OFFLINE.
If an administrator brings the offlined device back to SDEV_RUNNING via
sysfs, sas_device_priv_data->deleted stays 1, so _scsih_block_io_device()
and _scsih_block_io_all_device() will skip blocking that sdev on all future
DELAY_NOT_RESPONDING and broadcast primitive events.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261118-sas-abba-v3-0-5562d690cf61@kernel.org?part=11
next prev parent reply other threads:[~2026-11-18 23:33 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 23:09 [PATCH v3 00/11] scsi: mpt3sas: Fix delayed not-responding block deadlock and related bugs Jeff Layton
2026-11-18 23:09 ` [PATCH v3 01/11] scsi: mpt3sas: Don't leave requeued firmware events pending at teardown Jeff Layton
2026-11-18 23:33 ` sashiko-bot
2026-11-18 23:09 ` [PATCH v3 02/11] scsi: mpt3sas: Hold event references while cleaning up the event queue Jeff Layton
2026-11-18 23:10 ` [PATCH v3 03/11] scsi: mpt3sas: Requeue topology events only for busy devices Jeff Layton
2026-11-18 23:10 ` [PATCH v3 04/11] scsi: mpt3sas: Fix pcie_device leak in _scsih_ublock_io_device_wait() Jeff Layton
2026-11-18 23:10 ` [PATCH v3 05/11] scsi: mpt3sas: Restore unblock retry " Jeff Layton
2026-11-18 23:10 ` [PATCH v3 06/11] scsi: mpt3sas: Stop polling devices when the unresponding scan is cancelled Jeff Layton
2026-11-18 23:27 ` sashiko-bot
2026-11-18 23:10 ` [PATCH v3 07/11] scsi: mpt3sas: Reset the TUR retry count for each device Jeff Layton
2026-11-18 23:10 ` [PATCH v3 08/11] scsi: mpt3sas: Cache the missing delays the IOC actually uses Jeff Layton
2026-11-18 23:10 ` [PATCH v3 09/11] scsi: mpt3sas: Serialize interrupt-time sdev block with hostdata teardown Jeff Layton
2026-11-18 23:10 ` [PATCH v3 10/11] scsi: mpt3sas: Don't use freed hostdata while polling devices Jeff Layton
2026-11-18 23:23 ` sashiko-bot
2026-11-18 23:10 ` [PATCH v3 11/11] scsi: mpt3sas: Time out delayed not-responding device blocks Jeff Layton
2026-11-18 23:33 ` sashiko-bot [this message]
2026-11-18 23:13 ` [PATCH v3 00/11] scsi: mpt3sas: Fix delayed not-responding block deadlock and related bugs Jeff Layton
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=sashiko-outbox-222184@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=jlayton@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox