mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.com>
To: John Garry <john.g.garry@oracle.com>,
	hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com,
	james.bottomley@hansenpartnership.com, bmarzins@redhat.com
Cc: 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 7/8] scsi: scsi-multipath: Issue a periodic TUR per path
Date: Tue, 10 Mar 2026 14:34:06 +0100	[thread overview]
Message-ID: <fa7061d7-20f1-43e8-af65-2afb02e428f9@suse.com> (raw)
In-Reply-To: <20260310114925.1222263-8-john.g.garry@oracle.com>

On 3/10/26 12:49, John Garry wrote:
> To allow the initiator know of any ALUA configuration changes, issue a
> periodic TUR.
> 
> multipathd does something similar for dm-multipath in terms of issuing
> a periodic read per path.
> 
> The purpose of the TUR is that the target can update UA info in the TUR
> response and the INI can handle it, but currently we don't for SCSI
> multipath.
> 
> Signed-off-by: John Garry <john.g.garry@oracle.com>
> ---
>   drivers/scsi/scsi_multipath.c | 36 +++++++++++++++++++++++++++++++++++
>   include/scsi/scsi_multipath.h |  1 +
>   2 files changed, 37 insertions(+)
> 
> diff --git a/drivers/scsi/scsi_multipath.c b/drivers/scsi/scsi_multipath.c
> index 0c34b1151f5bf..2b916c7af4bd7 100644
> --- a/drivers/scsi/scsi_multipath.c
> +++ b/drivers/scsi/scsi_multipath.c
> @@ -4,6 +4,7 @@
>    *
>    */
>   
> +#include <linux/kthread.h>
>   #include <scsi/scsi_alua.h>
>   #include <scsi/scsi_cmnd.h>
>   #include <scsi/scsi_driver.h>
> @@ -124,6 +125,7 @@ static void scsi_mpath_head_release(struct device *dev)
>   		container_of(dev, struct scsi_mpath_head, dev);
>   	struct mpath_head *mpath_head = scsi_mpath_head->mpath_head;
>   
> +	WARN_ON_ONCE(kthread_stop(scsi_mpath_head->kua));
>   	scsi_mpath_delete_head(scsi_mpath_head);
>   	bioset_exit(&scsi_mpath_head->bio_pool);
>   	ida_free(&scsi_multipath_dev_ida, scsi_mpath_head->index);
> @@ -514,6 +516,29 @@ struct mpath_head_template smpdt_pr = {
>   	.device_groups = mpath_device_groups,
>   };
>   
> +static void scsi_mpath_cb_ua_thread(struct mpath_device *mpath_device)
> +{
> +	struct scsi_mpath_device *scsi_mpath_dev =
> +			to_scsi_mpath_device(mpath_device);
> +
> +	if (alua_tur(scsi_mpath_dev->sdev))
> +		sdev_printk(KERN_NOTICE, scsi_mpath_dev->sdev,
> +			    "%s: No target port descriptors found\n",
> +			    __func__);
> +}
> +
> +static int scsi_mpath_ua_thread(void *data)
> +{
> +	struct scsi_mpath_head *scsi_mpath_head = data;
> +
> +	while (!kthread_should_stop()) {
> +		mpath_call_for_all_devices(scsi_mpath_head->mpath_head,
> +			scsi_mpath_cb_ua_thread);
> +		msleep(5000);
> +	}
> +	return 0;
> +}
> +
>   static struct scsi_mpath_head *scsi_mpath_alloc_head(void)
>   {
>   	struct scsi_mpath_head *scsi_mpath_head;
> @@ -548,6 +573,17 @@ static struct scsi_mpath_head *scsi_mpath_alloc_head(void)
>   		goto out_free_ida;
>   	}
>   
> +	scsi_mpath_head->kua = kthread_create(scsi_mpath_ua_thread,
> +			scsi_mpath_head, "scsi-multipath-kua-%d",
> +			scsi_mpath_head->index);
> +	if (IS_ERR(scsi_mpath_head->kua)) {
> +		put_device(&scsi_mpath_head->dev);
> +		goto out_free_ida;
> +	}
> +
> +	set_user_nice(scsi_mpath_head->kua, 10);
> +	wake_up_process(scsi_mpath_head->kua);
> +
>   	return scsi_mpath_head;
>   
>   out_free_ida:
> diff --git a/include/scsi/scsi_multipath.h b/include/scsi/scsi_multipath.h
> index 7c7ee2fb7def7..d30f2c41e17de 100644
> --- a/include/scsi/scsi_multipath.h
> +++ b/include/scsi/scsi_multipath.h
> @@ -30,6 +30,7 @@ struct scsi_mpath_head {
>   	struct mpath_head	*mpath_head;
>   	struct device		dev;
>   	int			index;
> +	struct task_struct	*kua;
>   };
>   
>   struct scsi_mpath_device {

Please, don't. We should _not_ go into the business of doing TUR path 
checkers.
Path checkers turned out to be a major issue for multipathing, and
are mostly pointless for things like FC where you get reliable
path information via RSCNs.
Additionally I would advocate for scsi-multipath to be a _simple_
implementation, restricting to the most common scenarios. Namely
implicit ALUA only and reliable fabric notifications.
If you have anything else, fine, use dm-multipath.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
hare@suse.com                               +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich

  reply	other threads:[~2026-03-10 13:34 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
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 [this message]
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=fa7061d7-20f1-43e8-af65-2afb02e428f9@suse.com \
    --to=hare@suse.com \
    --cc=axboe@fb.com \
    --cc=bmarzins@redhat.com \
    --cc=dm-devel@lists.linux.dev \
    --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

all inboxes | Powered by JetHome®