|
|
8b67ad |
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
8b67ad |
From: Benjamin Marzinski <bmarzins@redhat.com>
|
|
|
8b67ad |
Date: Fri, 7 Oct 2022 12:35:44 -0500
|
|
|
8b67ad |
Subject: [PATCH] libmultipath: enforce queue_mode bio for nmve:tcp paths
|
|
|
8b67ad |
|
|
|
8b67ad |
nvme:tcp devices set BLK_MQ_F_BLOCKING (they are the only block devices
|
|
|
8b67ad |
which multipath supports that do so), meaning that block_mq expects that
|
|
|
8b67ad |
they can block at certain points while servicing a request. However,
|
|
|
8b67ad |
due to the way device-mapper sets up its queue, it is not able to set
|
|
|
8b67ad |
BLK_MQ_F_BLOCKING when it includes paths that set this flag. Patches
|
|
|
8b67ad |
were written to address this issue but they were rejected upstream
|
|
|
8b67ad |
|
|
|
8b67ad |
https://lore.kernel.org/linux-block/YcH%2FE4JNag0QYYAa@infradead.org/T/#t
|
|
|
8b67ad |
|
|
|
8b67ad |
The proposed solution was to have multipath use the bio queue_mode for
|
|
|
8b67ad |
multipath devices that include nvme:tcp paths.
|
|
|
8b67ad |
|
|
|
8b67ad |
Multipath devices now automatically add the "queue_mode bio" feature if
|
|
|
8b67ad |
they include nvme:tcp paths. If a multipath devices was created with
|
|
|
8b67ad |
"queue_mode rq", it will disallow the addition of nvme:tcp paths.
|
|
|
8b67ad |
|
|
|
8b67ad |
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
|
8b67ad |
Reviewed-by: Martin Wilck <mwilck@suse.com>
|
|
|
8b67ad |
---
|
|
|
8b67ad |
libmultipath/configure.c | 17 ++++++++++++++++-
|
|
|
8b67ad |
libmultipath/structs_vec.c | 7 +++++++
|
|
|
8b67ad |
multipath/multipath.conf.5 | 4 +++-
|
|
|
8b67ad |
3 files changed, 26 insertions(+), 2 deletions(-)
|
|
|
8b67ad |
|
|
|
8b67ad |
diff --git a/libmultipath/configure.c b/libmultipath/configure.c
|
|
|
8b67ad |
index 8e1bc488..c341793c 100644
|
|
|
8b67ad |
--- a/libmultipath/configure.c
|
|
|
8b67ad |
+++ b/libmultipath/configure.c
|
|
|
8b67ad |
@@ -297,6 +297,7 @@ int setup_map(struct multipath *mpp, char *params, int params_size,
|
|
|
8b67ad |
struct vectors *vecs)
|
|
|
8b67ad |
{
|
|
|
8b67ad |
struct pathgroup * pgp;
|
|
|
8b67ad |
+ struct path *pp;
|
|
|
8b67ad |
struct config *conf;
|
|
|
8b67ad |
int i, n_paths, marginal_pathgroups;
|
|
|
8b67ad |
|
|
|
8b67ad |
@@ -308,6 +309,14 @@ int setup_map(struct multipath *mpp, char *params, int params_size,
|
|
|
8b67ad |
return 1;
|
|
|
8b67ad |
}
|
|
|
8b67ad |
|
|
|
8b67ad |
+ /* Force QUEUE_MODE_BIO for maps with nvme:tcp paths */
|
|
|
8b67ad |
+ vector_foreach_slot(mpp->paths, pp, i) {
|
|
|
8b67ad |
+ if (pp->bus == SYSFS_BUS_NVME &&
|
|
|
8b67ad |
+ pp->sg_id.proto_id == NVME_PROTOCOL_TCP) {
|
|
|
8b67ad |
+ mpp->queue_mode = QUEUE_MODE_BIO;
|
|
|
8b67ad |
+ break;
|
|
|
8b67ad |
+ }
|
|
|
8b67ad |
+ }
|
|
|
8b67ad |
/*
|
|
|
8b67ad |
* free features, selector, and hwhandler properties if they are being reused
|
|
|
8b67ad |
*/
|
|
|
8b67ad |
@@ -1161,6 +1170,13 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
|
|
|
8b67ad |
continue;
|
|
|
8b67ad |
}
|
|
|
8b67ad |
|
|
|
8b67ad |
+ cmpp = find_mp_by_wwid(curmp, pp1->wwid);
|
|
|
8b67ad |
+ if (cmpp && cmpp->queue_mode == QUEUE_MODE_RQ &&
|
|
|
8b67ad |
+ pp1->bus == SYSFS_BUS_NVME && pp1->sg_id.proto_id ==
|
|
|
8b67ad |
+ NVME_PROTOCOL_TCP) {
|
|
|
8b67ad |
+ orphan_path(pp1, "nvme:tcp path not allowed with request queue_mode multipath device");
|
|
|
8b67ad |
+ continue;
|
|
|
8b67ad |
+ }
|
|
|
8b67ad |
/*
|
|
|
8b67ad |
* at this point, we know we really got a new mp
|
|
|
8b67ad |
*/
|
|
|
8b67ad |
@@ -1199,7 +1215,6 @@ int coalesce_paths (struct vectors * vecs, vector newmp, char * refwwid,
|
|
|
8b67ad |
}
|
|
|
8b67ad |
verify_paths(mpp, vecs);
|
|
|
8b67ad |
|
|
|
8b67ad |
- cmpp = find_mp_by_wwid(curmp, mpp->wwid);
|
|
|
8b67ad |
if (cmpp)
|
|
|
8b67ad |
mpp->queue_mode = cmpp->queue_mode;
|
|
|
8b67ad |
params[0] = '\0';
|
|
|
8b67ad |
diff --git a/libmultipath/structs_vec.c b/libmultipath/structs_vec.c
|
|
|
8b67ad |
index 8137ea21..24ac022e 100644
|
|
|
8b67ad |
--- a/libmultipath/structs_vec.c
|
|
|
8b67ad |
+++ b/libmultipath/structs_vec.c
|
|
|
8b67ad |
@@ -68,6 +68,13 @@ int adopt_paths(vector pathvec, struct multipath *mpp)
|
|
|
8b67ad |
pp->dev, mpp->alias);
|
|
|
8b67ad |
continue;
|
|
|
8b67ad |
}
|
|
|
8b67ad |
+ if (mpp->queue_mode == QUEUE_MODE_RQ &&
|
|
|
8b67ad |
+ pp->bus == SYSFS_BUS_NVME &&
|
|
|
8b67ad |
+ pp->sg_id.proto_id == NVME_PROTOCOL_TCP) {
|
|
|
8b67ad |
+ condlog(2, "%s: mulitpath device %s created with request queue_mode. Unable to add nvme:tcp paths",
|
|
|
8b67ad |
+ pp->dev, mpp->alias);
|
|
|
8b67ad |
+ continue;
|
|
|
8b67ad |
+ }
|
|
|
8b67ad |
condlog(3, "%s: ownership set to %s",
|
|
|
8b67ad |
pp->dev, mpp->alias);
|
|
|
8b67ad |
pp->mpp = mpp;
|
|
|
8b67ad |
diff --git a/multipath/multipath.conf.5 b/multipath/multipath.conf.5
|
|
|
8b67ad |
index 1f5a40b6..cb07a62c 100644
|
|
|
8b67ad |
--- a/multipath/multipath.conf.5
|
|
|
8b67ad |
+++ b/multipath/multipath.conf.5
|
|
|
8b67ad |
@@ -462,7 +462,9 @@ Before kernel 4.20 The default depends on the kernel parameter
|
|
|
8b67ad |
\fBdm_mod.use_blk_mq\fR. It is \fImq\fR if the latter is set, and \fIrq\fR
|
|
|
8b67ad |
otherwise. Since kernel 4.20, \fIrq\fR and \fImq\fR both correspond to
|
|
|
8b67ad |
block-multiqueue. Once a multipath device has been created, its queue_mode
|
|
|
8b67ad |
-cannot be changed.
|
|
|
8b67ad |
+cannot be changed. \fInvme:tcp\fR paths are only supported in multipath
|
|
|
8b67ad |
+devices with queue_mode set to \fIbio\fR. multipath will automatically
|
|
|
8b67ad |
+set this when creating a device with \fInvme:tcp\fR paths.
|
|
|
8b67ad |
.TP
|
|
|
8b67ad |
The default is: \fB<unset>\fR
|
|
|
8b67ad |
.RE
|