From: John Garry <john.g.garry@oracle.com>
To: hch@lst.de, kbusch@kernel.org, martin.petersen@oracle.com,
james.bottomley@hansenpartnership.com, hare@suse.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, John Garry <john.g.garry@oracle.com>
Subject: [PATCH 7/8] scsi: scsi-multipath: Issue a periodic TUR per path
Date: Tue, 10 Mar 2026 11:49:24 +0000 [thread overview]
Message-ID: <20260310114925.1222263-8-john.g.garry@oracle.com> (raw)
In-Reply-To: <20260310114925.1222263-1-john.g.garry@oracle.com>
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 {
--
2.43.5
next prev parent reply other threads:[~2026-03-10 11:50 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 ` John Garry [this message]
2026-03-10 13:34 ` [PATCH 7/8] scsi: scsi-multipath: Issue a periodic TUR per path 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=20260310114925.1222263-8-john.g.garry@oracle.com \
--to=john.g.garry@oracle.com \
--cc=axboe@fb.com \
--cc=bmarzins@redhat.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=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®