From: Benjamin Marzinski <bmarzins@redhat.com>
To: John Garry <john.g.garry@oracle.com>
Cc: hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com,
james.bottomley@hansenpartnership.com, hare@suse.com,
jmeneghi@redhat.com, linux-nvme@lists.infradead.org,
sagi@grimberg.me, axboe@fb.com, linux-scsi@vger.kernel.org,
michael.christie@oracle.com, snitzer@kernel.org,
dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org,
nilay@linux.ibm.com
Subject: Re: [PATCH 4/8] scsi: Create a core ALUA driver
Date: Sat, 14 Mar 2026 00:35:16 -0400 [thread overview]
Message-ID: <abTlhI0nO94Ax6gQ@redhat.com> (raw)
In-Reply-To: <20260310114925.1222263-5-john.g.garry@oracle.com>
On Tue, Mar 10, 2026 at 11:49:21AM +0000, John Garry wrote:
> Add a dedicated ALUA driver which can be used for native SCSI multipath
> and also DH-based ALUA support.
>
> Only core functions to submit a RTPG, STPG, tur, and also helper functions
> are added.
>
> The code from scsi_dh_alua.c to maintain the port groups is not added,
> because it is quite intertwined with the DH code. However the port group
> management code would be quite useful.
>
> Hannes Reinecke originally authored this code.
>
> Signed-off-by: John Garry <john.g.garry@oracle.com>
> diff --git a/drivers/scsi/scsi_alua.c b/drivers/scsi/scsi_alua.c
> new file mode 100644
> index 0000000000000..2e4102192dcb9
> --- /dev/null
> +++ b/drivers/scsi/scsi_alua.c
> @@ -0,0 +1,204 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Generic SCSI-3 ALUA SCSI driver
> + *
> + * Copyright (C) 2007-2010 Hannes Reinecke, SUSE Linux Products GmbH.
> + * All rights reserved.
> + */
> +
> +#include <scsi/scsi.h>
> +#include <scsi/scsi_proto.h>
> +#include <scsi/scsi_dbg.h>
> +#include <scsi/scsi_eh.h>
> +#include <scsi/scsi_alua.h>
> +
> +#define DRV_NAME "alua"
> +
> +#define ALUA_FAILOVER_RETRIES 5
> +
> +/*
> + * alua_check_tpgs - Evaluate TPGS setting
> + * @sdev: device to be checked
> + *
> + * Examine the TPGS setting of the sdev to find out if ALUA
> + * is supported.
> + */
> +int alua_check_tpgs(struct scsi_device *sdev)
> +{
> + int tpgs = TPGS_MODE_NONE;
> +
> + /*
> + * ALUA support for non-disk devices is fraught with
> + * difficulties, so disable it for now.
> + */
> + if (sdev->type != TYPE_DISK) {
> + sdev_printk(KERN_INFO, sdev,
> + "%s: disable for non-disk devices\n",
> + DRV_NAME);
> + return tpgs;
> + }
> +
> + tpgs = scsi_device_tpgs(sdev);
> + switch (tpgs) {
> + case TPGS_MODE_EXPLICIT|TPGS_MODE_IMPLICIT:
> + sdev_printk(KERN_INFO, sdev,
> + "%s: supports implicit and explicit TPGS\n",
> + DRV_NAME);
> + break;
> + case TPGS_MODE_EXPLICIT:
> + sdev_printk(KERN_INFO, sdev, "%s: supports explicit TPGS\n",
> + DRV_NAME);
> + break;
> + case TPGS_MODE_IMPLICIT:
> + sdev_printk(KERN_INFO, sdev, "%s: supports implicit TPGS\n",
> + DRV_NAME);
> + break;
> + case TPGS_MODE_NONE:
> + sdev_printk(KERN_INFO, sdev, "%s: not supported\n",
> + DRV_NAME);
> + break;
> + default:
> + sdev_printk(KERN_INFO, sdev,
> + "%s: unsupported TPGS setting %d\n",
> + DRV_NAME, tpgs);
> + tpgs = TPGS_MODE_NONE;
> + break;
> + }
> +
> + return tpgs;
> +}
> +EXPORT_SYMBOL_GPL(alua_check_tpgs);
> +
> +/*
> + * alua_tur - Send a TEST UNIT READY
> + * @sdev: device to which the TEST UNIT READY command should be send
> + *
> + * Send a TEST UNIT READY to @sdev to figure out the device state
> + * Returns SCSI_DH_RETRY if the sense code is NOT READY/ALUA TRANSITIONING,
> + * 0 if no error occurred, and SCSI_DH_IO otherwise.
Nitpick: The comment here still references SCSI_DH_ values
-Ben
> + */
> +int alua_tur(struct scsi_device *sdev)
next prev parent reply other threads:[~2026-03-14 4:35 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 11:49 [PATCH 0/8] scsi-multipath: Basic ALUA support John Garry
2026-03-10 11:49 ` [PATCH 1/8] libmultipath: add mpath_call_for_all_devices() John Garry
2026-03-10 11:49 ` [PATCH 2/8] scsi: scsi_dh_alua: Do not attach for SCSI native multipath John Garry
2026-03-10 11:49 ` [PATCH 3/8] scsi: scsi_dh_alua: Pass submit_rtpg() a bool for extended header support John Garry
2026-03-10 11:49 ` [PATCH 4/8] scsi: Create a core ALUA driver John Garry
2026-03-14 4:35 ` Benjamin Marzinski [this message]
2026-03-16 9:12 ` John Garry
2026-03-10 11:49 ` [PATCH 5/8] scsi: scsi-multipath: Add basic ALUA support John Garry
2026-03-10 13:23 ` Hannes Reinecke
2026-03-10 15:52 ` John Garry
2026-03-10 17:54 ` Hannes Reinecke
2026-03-10 18:13 ` John Garry
2026-03-14 4:48 ` Benjamin Marzinski
2026-03-16 9:25 ` John Garry
2026-03-10 11:49 ` [PATCH 6/8] scsi: scsi-multipath: Maintain sdev->access_state John Garry
2026-03-10 13:27 ` Hannes Reinecke
2026-03-10 15:54 ` John Garry
2026-03-10 11:49 ` [PATCH 7/8] scsi: scsi-multipath: Issue a periodic TUR per path John Garry
2026-03-10 13:34 ` Hannes Reinecke
2026-03-10 17:21 ` John Garry
2026-03-10 11:49 ` [PATCH 8/8] scsi: scsi-multipath: Add stubbed scsi_multipath_dev_rescan() John Garry
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=abTlhI0nO94Ax6gQ@redhat.com \
--to=bmarzins@redhat.com \
--cc=axboe@fb.com \
--cc=dm-devel@lists.linux.dev \
--cc=hare@suse.com \
--cc=hch@lst.de \
--cc=james.bottomley@hansenpartnership.com \
--cc=jmeneghi@redhat.com \
--cc=john.g.garry@oracle.com \
--cc=kbusch@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=michael.christie@oracle.com \
--cc=nilay@linux.ibm.com \
--cc=sagi@grimberg.me \
--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