From: John Garry <john.g.garry@oracle.com>
To: Benjamin Marzinski <bmarzins@redhat.com>
Cc: martin.petersen@oracle.com,
james.bottomley@hansenpartnership.com, hare@suse.com,
jmeneghi@redhat.com, linux-scsi@vger.kernel.org,
michael.christie@oracle.com, snitzer@kernel.org,
dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 13/13] scsi: core: Add implicit ALUA support
Date: Mon, 23 Mar 2026 12:52:18 +0000 [thread overview]
Message-ID: <1f6d5e0c-41f9-440b-a7f0-4850477309fe@oracle.com> (raw)
In-Reply-To: <acCeVabspYFjQHPu@redhat.com>
On 23/03/2026 01:58, Benjamin Marzinski wrote:
> On Tue, Mar 17, 2026 at 12:07:03PM +0000, John Garry wrote:
>> For when no device handler is used, add ALUA support.
>>
>> This will be equivalent to when native SCSI multipathing is used.
>>
>> Essentially all the same handling is available as DH alua driver for
>> rescan, request prep, sense handling.
>>
>> Signed-off-by: John Garry <john.g.garry@oracle.com>
>> ---
>> drivers/scsi/scsi_alua.c | 93 +++++++++++++++++++++++++++++++++++++++
>> drivers/scsi/scsi_error.c | 7 +++
>> drivers/scsi/scsi_lib.c | 7 +++
>> drivers/scsi/scsi_scan.c | 2 +
>> drivers/scsi/scsi_sysfs.c | 4 +-
>> include/scsi/scsi_alua.h | 14 ++++++
>> 6 files changed, 126 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/scsi/scsi_alua.c b/drivers/scsi/scsi_alua.c
>> index d3fcd887e5018..ee0229b1a9d12 100644
>> --- a/drivers/scsi/scsi_alua.c
>> +++ b/drivers/scsi/scsi_alua.c
>> @@ -562,6 +562,90 @@ int scsi_alua_stpg_run(struct scsi_device *sdev, bool optimize)
>> }
>> EXPORT_SYMBOL_GPL(scsi_alua_stpg_run);
>>
>> +enum scsi_disposition scsi_alua_check_sense(struct scsi_device *sdev,
>> + struct scsi_sense_hdr *sense_hdr)
>
> This seems like it should be shareable with scsi_dh_alua as well. In
> might need to take a function to call for rescanning and have
> alua_check_sense() be a wrapper around it, but since the force argument
> to alua_check() is now always set to true in scsi_dh_alua, it's
> unnecessary, so both it and scsi_device_alua_rescan() can have the
> same arguments.
Yeah, I tried it and I just thought that adding the rescan callback was
a bit messy. I can go with the single function if we think it's better.
>
>> +{
>> + switch (sense_hdr->sense_key) {
>> + case NOT_READY:
>> + if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x0a) {
>> + /*
>> + * LUN Not Accessible - ALUA state transition
>> + */
>> + scsi_alua_handle_state_transition(sdev);
>> + return NEEDS_RETRY;
>> + }
>> + break;
>> + case UNIT_ATTENTION:
>> + if (sense_hdr->asc == 0x04 && sense_hdr->ascq == 0x0a) {
>> + /*
>> + * LUN Not Accessible - ALUA state transition
>> + */
>> + scsi_alua_handle_state_transition(sdev);
>> + return NEEDS_RETRY;
>> + }
>> + if (sense_hdr->asc == 0x29 && sense_hdr->ascq == 0x00) {
>> + /*
>> + * Power On, Reset, or Bus Device Reset.
>> + * Might have obscured a state transition,
>> + * so schedule a recheck.
>> + */
>> + scsi_device_alua_rescan(sdev);
>> + return ADD_TO_MLQUEUE;
>> + }
>> + if (sense_hdr->asc == 0x29 && sense_hdr->ascq == 0x04)
>> + /*
>> + * Device internal reset
>> + */
>> + return ADD_TO_MLQUEUE;
>> + if (sense_hdr->asc == 0x2a && sense_hdr->ascq == 0x01)
>> + /*
>> + * Mode Parameters Changed
>> + */
>> + return ADD_TO_MLQUEUE;
>> + if (sense_hdr->asc == 0x2a && sense_hdr->ascq == 0x06) {
>> + /*
>> + * ALUA state changed
>> + */
>> + scsi_device_alua_rescan(sdev);
>> + return ADD_TO_MLQUEUE;
>> + }
>> + if (sense_hdr->asc == 0x2a && sense_hdr->ascq == 0x07) {
>> + /*
>> + * Implicit ALUA state transition failed
>> + */
>> + scsi_device_alua_rescan(sdev);
>> + return ADD_TO_MLQUEUE;
>> + }
>> + if (sense_hdr->asc == 0x3f && sense_hdr->ascq == 0x03)
>> + /*
>> + * Inquiry data has changed
>> + */
>> + return ADD_TO_MLQUEUE;
>> + if (sense_hdr->asc == 0x3f && sense_hdr->ascq == 0x0e)
>> + /*
>> + * REPORTED_LUNS_DATA_HAS_CHANGED is reported
>> + * when switching controllers on targets like
>> + * Intel Multi-Flex. We can just retry.
>> + */
>> + return ADD_TO_MLQUEUE;
>> + break;
>> + }
>> +
>> + return SCSI_RETURN_NOT_HANDLED;
>> +}
>> +
>> +static void alua_rtpg_work(struct work_struct *work)
>> +{
>> + struct alua_data *alua =
>> + container_of(work, struct alua_data, work.work);
>> + int ret;
>> +
>> + ret = scsi_alua_rtpg_run(alua->sdev);
>> +
>> + if (ret == -EAGAIN)
>> + queue_delayed_work(kalua_wq, &alua->work, alua->interval * HZ);
>> +}
>> +
>> int scsi_alua_sdev_init(struct scsi_device *sdev)
>> {
>> int rel_port, ret, tpgs;
>> @@ -591,6 +675,7 @@ int scsi_alua_sdev_init(struct scsi_device *sdev)
>> goto out_free_data;
>> }
>>
>> + INIT_DELAYED_WORK(&sdev->alua->work, alua_rtpg_work);
>> sdev->alua->sdev = sdev;
>> sdev->alua->tpgs = tpgs;
>> spin_lock_init(&sdev->alua->lock);
>> @@ -638,6 +723,14 @@ bool scsi_device_alua_implicit(struct scsi_device *sdev)
>> return sdev->alua->tpgs & TPGS_MODE_IMPLICIT;
>> }
>>
>> +void scsi_device_alua_rescan(struct scsi_device *sdev)
>> +{
>> + struct alua_data *alua = sdev->alua;
>> +
>> + queue_delayed_work(kalua_wq, &alua->work,
>> + msecs_to_jiffies(ALUA_RTPG_DELAY_MSECS));
>
> This code doesn't support triggering a new rtpg while the current one is
> running. I'll leave it to people with more scsi expertise to say how
> important that is, but the scsi_dh_alua code now will always trigger a
> new rtpg in this case (or at least it would, with the issues from patch
> 12 fixed).
>
If the work is running and we call queue_delayed_work() on the same
work_struct, then it is enqueued again. If the work is pending and we
call queue_delayed_work(), then it is not requeued (as it is already
queued).
Thanks,
John
next prev parent reply other threads:[~2026-03-23 12:52 UTC|newest]
Thread overview: 63+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-17 12:06 [PATCH 00/13] scsi: Core ALUA driver John Garry
2026-03-17 12:06 ` [PATCH 01/13] scsi: scsi_dh_alua: Delete alua_port_group John Garry
2026-03-18 7:44 ` Hannes Reinecke
2026-03-18 8:53 ` John Garry
2026-03-23 0:08 ` Benjamin Marzinski
2026-03-23 10:33 ` John Garry
2026-03-23 16:15 ` Benjamin Marzinski
2026-03-23 18:07 ` John Garry
2026-03-17 12:06 ` [PATCH 02/13] scsi: alua: Create a core ALUA driver John Garry
2026-03-18 7:47 ` Hannes Reinecke
2026-03-23 12:56 ` John Garry
2026-03-18 17:17 ` kernel test robot
2026-03-18 22:54 ` kernel test robot
2026-03-17 12:06 ` [PATCH 03/13] scsi: alua: Add scsi_alua_rtpg() John Garry
2026-03-18 7:50 ` Hannes Reinecke
2026-03-23 12:58 ` John Garry
2026-03-17 12:06 ` [PATCH 04/13] scsi: alua: Add scsi_alua_stpg() John Garry
2026-03-18 7:53 ` Hannes Reinecke
2026-03-17 12:06 ` [PATCH 05/13] scsi: alua: Add scsi_alua_tur() John Garry
2026-03-18 7:54 ` Hannes Reinecke
2026-03-23 13:42 ` John Garry
2026-03-24 10:49 ` John Garry
2026-03-17 12:06 ` [PATCH 06/13] scsi: alua: Add scsi_alua_rtpg_run() John Garry
2026-03-17 12:06 ` [PATCH 07/13] scsi: alua: Add scsi_alua_stpg_run() John Garry
2026-03-18 7:57 ` Hannes Reinecke
2026-03-18 8:59 ` John Garry
2026-03-18 9:24 ` Hannes Reinecke
2026-03-23 13:58 ` John Garry
2026-03-17 12:06 ` [PATCH 08/13] scsi: alua: Add scsi_alua_check_tpgs() John Garry
2026-03-18 7:57 ` Hannes Reinecke
2026-03-17 12:06 ` [PATCH 09/13] scsi: alua: Add scsi_alua_handle_state_transition() John Garry
2026-03-18 7:58 ` Hannes Reinecke
2026-03-23 13:43 ` John Garry
2026-03-17 12:07 ` [PATCH 10/13] scsi: alua: Add scsi_alua_prep_fn() John Garry
2026-03-18 8:01 ` Hannes Reinecke
2026-03-23 13:49 ` John Garry
2026-03-17 12:07 ` [PATCH 11/13] scsi: alua: Add scsi_device_alua_implicit() John Garry
2026-03-18 8:02 ` Hannes Reinecke
2026-03-23 13:50 ` John Garry
2026-03-17 12:07 ` [PATCH 12/13] scsi: scsi_dh_alua: Switch to use core support John Garry
2026-03-23 1:47 ` Benjamin Marzinski
2026-03-23 11:59 ` John Garry
2026-03-17 12:07 ` [PATCH 13/13] scsi: core: Add implicit ALUA support John Garry
2026-03-18 8:08 ` Hannes Reinecke
2026-03-18 23:08 ` kernel test robot
2026-03-23 1:58 ` Benjamin Marzinski
2026-03-23 12:52 ` John Garry [this message]
2026-03-23 17:29 ` Benjamin Marzinski
2026-03-23 18:13 ` John Garry
2026-03-22 17:37 ` [PATCH 00/13] scsi: Core ALUA driver Benjamin Marzinski
2026-03-23 9:57 ` John Garry
2026-03-23 16:25 ` Benjamin Marzinski
2026-03-23 18:04 ` John Garry
2026-03-23 19:45 ` Benjamin Marzinski
2026-03-24 10:57 ` John Garry
2026-03-24 13:58 ` Benjamin Marzinski
2026-03-24 15:12 ` John Garry
2026-03-24 15:48 ` Benjamin Marzinski
2026-03-24 16:25 ` John Garry
2026-03-26 10:19 ` Hannes Reinecke
2026-03-26 12:16 ` John Garry
2026-03-27 7:02 ` Hannes Reinecke
2026-03-26 10:17 ` Hannes Reinecke
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=1f6d5e0c-41f9-440b-a7f0-4850477309fe@oracle.com \
--to=john.g.garry@oracle.com \
--cc=bmarzins@redhat.com \
--cc=dm-devel@lists.linux.dev \
--cc=hare@suse.com \
--cc=james.bottomley@hansenpartnership.com \
--cc=jmeneghi@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=michael.christie@oracle.com \
--cc=snitzer@kernel.org \
/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
all inboxes | Powered by JetHome®