Skip to contentSkip to conversation

drbd: fix rdma dependency

PATCH In review Arnd Bergmann 3 participants 7 messages Mar 18

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drbd: fix rdma dependency

From: Arnd Bergmann <[email protected]>

The new rdma transport module uses a trick to only build support if infiniband/rdma is enabled. This seems to be done the wrong way around, as it gets built if RDMA is in a loadable module, but not if it's built-in.

However, this fails in configurations that have infiniband support in a loadable module but drbd built-in:

ERROR: modpost: "rdma_bind_addr" [drivers/block/drbd/drbd_transport_rdma.ko] undefined!
ERROR: modpost: "rdma_listen" [drivers/block/drbd/drbd_transport_rdma.ko] undefined!
ERROR: modpost: "rdma_destroy_id" [drivers/block/drbd/drbd_transport_rdma.ko] undefined!
ERROR: modpost: "rdma_destroy_qp" [drivers/block/drbd/drbd_transport_rdma.ko] undefined!
ERROR: modpost: "rdma_disconnect" [drivers/block/drbd/drbd_transport_rdma.ko] undefined!
ERROR: modpost: "__rdma_create_kernel_id" [drivers/block/drbd/drbd_transport_rdma.ko] undefined!
ERROR: modpost: "rdma_resolve_route" [drivers/block/drbd/drbd_transport_rdma.ko] undefined!
ERROR: modpost: "rdma_reject" [drivers/block/drbd/drbd_transport_rdma.ko] undefined!
ERROR: modpost: "rdma_accept" [drivers/block/drbd/drbd_transport_rdma.ko] undefined!
ERROR: modpost: "rdma_create_qp" [drivers/block/drbd/drbd_transport_rdma.ko] undefined!

Address this by moving the logic from Makefile into Kconfig and describing the two conditions in which rdma transport can be used in drbd.

Fixes 038cb6e644e4 ("drbd: add RDMA transport implementation")
---
 drivers/block/drbd/Kconfig  | 5 +++++
 drivers/block/drbd/Makefile | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/block/drbd/Kconfig +5 -0
index 377f0d040031..29ec6ed84251 100644
@@ -39,6 +39,11 @@ config BLK_DEV_DRBD
 
 	  If unsure, say N.
 
+config DRBD_TRANSPORT_RDMA
+	tristate
+	depends on RDMA=y || (BLK_DEV_DRBD=RDMA)
+	default BLK_DEV_DRBD
+
 config DRBD_FAULT_INJECTION
 	bool "DRBD fault injection"
 	depends on BLK_DEV_DRBD
drivers/block/drbd/Makefile +1 -1
index 99a1cfeed423..caf888235d53 100644
@@ -13,4 +13,4 @@ obj-$(CONFIG_BLK_DEV_DRBD)     += drbd.o
 
 obj-$(CONFIG_BLK_DEV_DRBD)     += drbd_transport_tcp.o
 obj-$(CONFIG_BLK_DEV_DRBD)     += drbd_transport_lb-tcp.o
-obj-$(if $(CONFIG_BLK_DEV_DRBD),$(if $(CONFIG_INFINIBAND),m)) += drbd_transport_rdma.o
+obj-$(CONFIG_DRBD_TRANSPORT_RDMA) += drbd_transport_rdma.o
Signature · 1 line
2.39.5
#1 lore raw

PATCH 2/2 drbd: select CONFIG_NET_HANDSHAKE

From: Arnd Bergmann <[email protected]>

The TLS handshake code is optional and has to be enabled for DRBD:

ERROR: modpost: "tls_handshake_cancel" [drivers/block/drbd/drbd_transport_tcp.ko] undefined!
ERROR: modpost: "tls_server_hello_x509" [drivers/block/drbd/drbd_transport_tcp.ko] undefined!
ERROR: modpost: "tls_client_hello_x509" [drivers/block/drbd/drbd_transport_tcp.ko] undefined!
ERROR: modpost: "tls_get_record_type" [drivers/block/drbd/drbd_transport_tcp.ko] undefined!
ERROR: modpost: "tls_alert_recv" [drivers/block/drbd/drbd_transport_tcp.ko] undefined!

Select the option whenever DRBD is eanbled and rework the dependency in the symbol so it can be selected more easily.

Fixes fa8ef6960ebd ("drbd: add TCP transport implementation")
---
 drivers/block/drbd/Kconfig | 1 +
 net/Kconfig                | 4 +---
 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/block/drbd/Kconfig +1 -0
index 29ec6ed84251..de9e232d6479 100644
@@ -11,6 +11,7 @@ config BLK_DEV_DRBD
 	depends on PROC_FS && INET
 	select LRU_CACHE
 	select CRC32
+	select NET_HANDSHAKE
 	help
 
 	  NOTE: In order to authenticate connections you have to select
net/Kconfig +1 -3
index 62266eaf0e95..769880113740 100644
@@ -92,9 +92,7 @@ source "drivers/dibs/Kconfig"
 source "net/xdp/Kconfig"
 
 config NET_HANDSHAKE
-	bool
-	depends on SUNRPC || NVME_TARGET_TCP || NVME_TCP
-	default y
+	def_bool SUNRPC || NVME_TARGET_TCP || NVME_TCP
 
 config NET_HANDSHAKE_KUNIT_TEST
 	tristate "KUnit tests for the handshake upcall mechanism" if !KUNIT_ALL_TESTS
Signature · 1 line
2.39.5
#4 lore raw
In reply to Arnd Bergmann

Am 18.03.26 um 11:48 schrieb Arnd Bergmann:

Quoted 53 lines

From: Arnd Bergmann <[email protected]>

The new rdma transport module uses a trick to only build support if infiniband/rdma is enabled. This seems to be done the wrong way around, as it gets built if RDMA is in a loadable module, but not if it's built-in.

However, this fails in configurations that have infiniband support in a loadable module but drbd built-in:

ERROR: modpost: "rdma_bind_addr" [drivers/block/drbd/drbd_transport_rdma.ko] undefined!
ERROR: modpost: "rdma_listen" [drivers/block/drbd/drbd_transport_rdma.ko] undefined!
ERROR: modpost: "rdma_destroy_id" [drivers/block/drbd/drbd_transport_rdma.ko] undefined!
ERROR: modpost: "rdma_destroy_qp" [drivers/block/drbd/drbd_transport_rdma.ko] undefined!
ERROR: modpost: "rdma_disconnect" [drivers/block/drbd/drbd_transport_rdma.ko] undefined!
ERROR: modpost: "__rdma_create_kernel_id" [drivers/block/drbd/drbd_transport_rdma.ko] undefined!
ERROR: modpost: "rdma_resolve_route" [drivers/block/drbd/drbd_transport_rdma.ko] undefined!
ERROR: modpost: "rdma_reject" [drivers/block/drbd/drbd_transport_rdma.ko] undefined!
ERROR: modpost: "rdma_accept" [drivers/block/drbd/drbd_transport_rdma.ko] undefined!
ERROR: modpost: "rdma_create_qp" [drivers/block/drbd/drbd_transport_rdma.ko] undefined!

Address this by moving the logic from Makefile into Kconfig and describing the two conditions in which rdma transport can be used in drbd.

Fixes 038cb6e644e4 ("drbd: add RDMA transport implementation")
---
 drivers/block/drbd/Kconfig  | 5 +++++
 drivers/block/drbd/Makefile | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/block/drbd/Kconfig +5 -0
index 377f0d040031..29ec6ed84251 100644
@@ -39,6 +39,11 @@ config BLK_DEV_DRBD
 
 	  If unsure, say N.
 
+config DRBD_TRANSPORT_RDMA
+	tristate
+	depends on RDMA=y || (BLK_DEV_DRBD=RDMA)
+	default BLK_DEV_DRBD
+
 config DRBD_FAULT_INJECTION
 	bool "DRBD fault injection"
 	depends on BLK_DEV_DRBD
drivers/block/drbd/Makefile +0 -0
index 99a1cfeed423..caf888235d53 100644

drivers/block/drbd/Makefile obj-$(CONFIG_BLK_DEV_DRBD) += drbd.o · line 16

Quoted 5 lines
drivers/block/drbd/Makefile +1 -1
@@ -13,4 +13,4 @@ obj-$(CONFIG_BLK_DEV_DRBD)     += drbd.o
 
 obj-$(CONFIG_BLK_DEV_DRBD)     += drbd_transport_tcp.o
 obj-$(CONFIG_BLK_DEV_DRBD)     += drbd_transport_lb-tcp.o
-obj-$(if $(CONFIG_BLK_DEV_DRBD),$(if $(CONFIG_INFINIBAND),m)) += drbd_transport_rdma.o
+obj-$(CONFIG_DRBD_TRANSPORT_RDMA) += drbd_transport_rdma.o

Seems like we raced here, I already (supposedly?) fixed this on the drbd-next branch.

My fix is this Kconfig:

config BLK_DEV_DRBD_RDMA
tristate "DRBD RDMA transport"
depends on BLK_DEV_DRBD && INFINIBAND_ADDR_TRANS help

RDMA transport support for DRBD. This enables DRBD replication over RDMA-capable networks for lower latency and higher throughput.

If unsure, say N.

And then just this in the Makefile:

obj-$(CONFIG_BLK_DEV_DRBD_RDMA) += drbd_transport_rdma.o

That should be equivalent, right?

Thanks,
Christoph

Signature · 3 lines
Christoph Böhmwalder
LINBIT | Keeping the Digital World Running
DRBD HA —  Disaster Recovery — Software defined Storage
#5 lore raw
Quoted 4 lines · Christoph Böhmwalder

Am 18.03.26 um 11:48 schrieb Arnd Bergmann:

Seems like we raced here, I already (supposedly?) fixed this on the drbd-next branch.

Ok, I assume that will be in linux-next

Quoted 10 lines

My fix is this Kconfig:

config BLK_DEV_DRBD_RDMA
tristate "DRBD RDMA transport"
depends on BLK_DEV_DRBD && INFINIBAND_ADDR_TRANS help

RDMA transport support for DRBD. This enables DRBD replication over RDMA-capable networks for lower latency and higher throughput.

Quoted 7 lines

If unsure, say N.

And then just this in the Makefile:

obj-$(CONFIG_BLK_DEV_DRBD_RDMA) += drbd_transport_rdma.o

That should be equivalent, right?

It's close but not the same:

- INFINIBAND_ADDR_TRANS is a 'bool' symbol that can still be =y when CONFIG_INFINIBAND=m, so you'd still fail to build BLK_DEV_DRBD_RDMA. You still need a dependency on INFINIBAND (the tristate symbol) itself, though you probably also need the INFINIBAND_ADDR_TRANS one that I missed

- I incorrectly assumed from the earlier Makefile logic that the rdma transport exports symbols that are used by the common drbd code, but I now see that the opposite is the case. The difference is that for the case of BLK_DEV_DRBD=y, CONFIG_INFINIBAND=m, my version force-disabled the RDMA transport, while it should be in a loadable module.

It seems both versions are wrong then, but just adding 'depends on INFINIBAND' on top of yours should fix it.

Arnd

#6 lore raw

Am 18.03.26 um 16:31 schrieb Arnd Bergmann:

Quoted 7 lines · Christoph Böhmwalder
Quoted 4 lines

Am 18.03.26 um 11:48 schrieb Arnd Bergmann:

Seems like we raced here, I already (supposedly?) fixed this on the drbd-next branch.

Ok, I assume that will be in linux-next

Correct, should land there today.

Quoted 34 lines
Quoted 11 lines

My fix is this Kconfig:

config BLK_DEV_DRBD_RDMA
tristate "DRBD RDMA transport"
depends on BLK_DEV_DRBD && INFINIBAND_ADDR_TRANS help

RDMA transport support for DRBD. This enables DRBD replication over RDMA-capable networks for lower latency and higher throughput.

Quoted 7 lines

If unsure, say N.

And then just this in the Makefile:

obj-$(CONFIG_BLK_DEV_DRBD_RDMA) += drbd_transport_rdma.o

That should be equivalent, right?

It's close but not the same:

- INFINIBAND_ADDR_TRANS is a 'bool' symbol that can still be =y when CONFIG_INFINIBAND=m, so you'd still fail to build BLK_DEV_DRBD_RDMA. You still need a dependency on INFINIBAND (the tristate symbol) itself, though you probably also need the INFINIBAND_ADDR_TRANS one that I missed

- I incorrectly assumed from the earlier Makefile logic that the rdma transport exports symbols that are used by the common drbd code, but I now see that the opposite is the case. The difference is that for the case of BLK_DEV_DRBD=y, CONFIG_INFINIBAND=m, my version force-disabled the RDMA transport, while it should be in a loadable module.

Quoted 2 lines

It seems both versions are wrong then, but just adding 'depends on INFINIBAND' on top of yours should fix it.

Yes, ADDR_TRANS is needed because we need the infiniband "cm" infrastructure (for rdma_connect et al).
Right, I did not catch that we need CONFIG_INFINIBAND separately as well, but that seems logical.
I applied the combined fix now.

Thanks,
Christoph

Signature · 3 lines
Christoph Böhmwalder
LINBIT | Keeping the Digital World Running
DRBD HA —  Disaster Recovery — Software defined Storage
#2 lore raw

Re: [PATCH 2/2] drbd: select CONFIG_NET_HANDSHAKE

In reply to Arnd Bergmann

Am 18.03.26 um 11:48 schrieb Arnd Bergmann:

Quoted 37 lines

From: Arnd Bergmann <[email protected]>

The TLS handshake code is optional and has to be enabled for DRBD:

ERROR: modpost: "tls_handshake_cancel" [drivers/block/drbd/drbd_transport_tcp.ko] undefined!
ERROR: modpost: "tls_server_hello_x509" [drivers/block/drbd/drbd_transport_tcp.ko] undefined!
ERROR: modpost: "tls_client_hello_x509" [drivers/block/drbd/drbd_transport_tcp.ko] undefined!
ERROR: modpost: "tls_get_record_type" [drivers/block/drbd/drbd_transport_tcp.ko] undefined!
ERROR: modpost: "tls_alert_recv" [drivers/block/drbd/drbd_transport_tcp.ko] undefined!

Select the option whenever DRBD is eanbled and rework the dependency in the symbol so it can be selected more easily.

Fixes fa8ef6960ebd ("drbd: add TCP transport implementation")
---
 drivers/block/drbd/Kconfig | 1 +
 net/Kconfig                | 4 +---
 2 files changed, 2 insertions(+), 3 deletions(-)
drivers/block/drbd/Kconfig +1 -0
index 29ec6ed84251..de9e232d6479 100644
@@ -11,6 +11,7 @@ config BLK_DEV_DRBD
 	depends on PROC_FS && INET
 	select LRU_CACHE
 	select CRC32
+	select NET_HANDSHAKE
 	help
 
 	  NOTE: In order to authenticate connections you have to select
net/Kconfig +0 -0
index 62266eaf0e95..769880113740 100644

net/Kconfig source "drivers/dibs/Kconfig" · line 98

Quoted 10 lines
net/Kconfig +1 -3
@@ -92,9 +92,7 @@ source "drivers/dibs/Kconfig"
 source "net/xdp/Kconfig"
 
 config NET_HANDSHAKE
-	bool
-	depends on SUNRPC || NVME_TARGET_TCP || NVME_TCP
-	default y
+	def_bool SUNRPC || NVME_TARGET_TCP || NVME_TCP
 
 config NET_HANDSHAKE_KUNIT_TEST
 	tristate "KUnit tests for the handshake upcall mechanism" if !KUNIT_ALL_TESTS

Thanks for the fix, I applied it to our drbd-next tree (which should end up in linux-next).

I would prefer to squash these kinds of fixups to keep the history in our patch series clean.
Arnd, does that work for you? How do you prefer we handle attribution?

Unfortunately I couldn't really find a clear precedence pattern for this, how is this usually handled?

Signature · 3 lines
Christoph Böhmwalder
LINBIT | Keeping the Digital World Running
DRBD HA —  Disaster Recovery — Software defined Storage
#3 lore raw

Re: [PATCH 2/2] drbd: select CONFIG_NET_HANDSHAKE

Quoted 8 lines · Christoph Böhmwalder

Am 18.03.26 um 11:48 schrieb Arnd Bergmann:

Quoted 2 lines

config NET_HANDSHAKE_KUNIT_TEST
tristate "KUnit tests for the handshake upcall mechanism" if !KUNIT_ALL_TESTS

Thanks for the fix, I applied it to our drbd-next tree (which should end up in linux-next).

Quoted 6 lines

I would prefer to squash these kinds of fixups to keep the history in our patch series clean.
Arnd, does that work for you? How do you prefer we handle attribution?

Unfortunately I couldn't really find a clear precedence pattern for this, how is this usually handled?

Whichever way works best for you. Some people care a lot about attribution for bugfixes, but I generally prefer a clean history myself.

Arnd