Distributed Replicated Block Device (DRBD) development
 help / color / mirror / Atom feed
* [Drbd-dev] Get drbd-9.0 branch building with Linux 5.9 and 5.10
@ 2020-12-13  5:06 Michael D Labriola
  2020-12-13  5:06 ` [Drbd-dev] [PATCH 1/8] compat: fix include for submit_bio test Michael D Labriola
                   ` (7 more replies)
  0 siblings, 8 replies; 10+ messages in thread
From: Michael D Labriola @ 2020-12-13  5:06 UTC (permalink / raw)
  To: drbd-dev

Hey, everyone! I had the chance to try building the latest drbd-9.0
code against the 5.9 and 5.10 kernels this afternoon. Things almost
built, but not quite.  I made a series of commits to get things
compiling.  Most of it is trivial compat test changes and following
along w/ what's already been done in the mainline drbd8 module to get
it ready for 5.10.

I did not create a compat test for the switch from
sched_setscheduler() to sched_set_fifo_low() yet.  Mostly, because
I've never done that and have to wrap my head around how to add
another test. ;-)

I tried submitting a pull request via github, but got the auto-close
message.  So, here's take two.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* [Drbd-dev] [PATCH 1/8] compat: fix include for submit_bio test
  2020-12-13  5:06 [Drbd-dev] Get drbd-9.0 branch building with Linux 5.9 and 5.10 Michael D Labriola
@ 2020-12-13  5:06 ` Michael D Labriola
  2020-12-13  5:06 ` [Drbd-dev] [PATCH 2/8] compat: fix include for blkdev_get_by_path test Michael D Labriola
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Michael D Labriola @ 2020-12-13  5:06 UTC (permalink / raw)
  To: drbd-dev

Looks like this test is including the wrong header to get at struct
block_device_operations.

Signed-off-by: Michael D Labriola <michael.d.labriola@gmail.com>
---
 drbd/drbd-kernel-compat/tests/have_submit_bio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drbd/drbd-kernel-compat/tests/have_submit_bio.c b/drbd/drbd-kernel-compat/tests/have_submit_bio.c
index 26bc7e8c..ca94cd27 100644
--- a/drbd/drbd-kernel-compat/tests/have_submit_bio.c
+++ b/drbd/drbd-kernel-compat/tests/have_submit_bio.c
@@ -1,6 +1,6 @@
 /* { "version": "v5.8", "commit": "c62b37d96b6eb3ec5ae4cbe00db107bf15aebc93", "comment": "Since 5.8 make_request_fn has been replaced by a block_device_operations method called submit_bio", "author": "Christoph Hellwig <hch@lst.de>", "date": "Wed Jul 1 10:59:43 2020 +0200" } */
 
-#include <linux/blk_types.h>
+#include <linux/blkdev.h>
 
 void foo(struct block_device_operations *ops)
 {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Drbd-dev] [PATCH 2/8] compat: fix include for blkdev_get_by_path test
  2020-12-13  5:06 [Drbd-dev] Get drbd-9.0 branch building with Linux 5.9 and 5.10 Michael D Labriola
  2020-12-13  5:06 ` [Drbd-dev] [PATCH 1/8] compat: fix include for submit_bio test Michael D Labriola
@ 2020-12-13  5:06 ` Michael D Labriola
  2020-12-13  5:06 ` [Drbd-dev] [PATCH 3/8] drbd: don't include vermagic.h Michael D Labriola
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Michael D Labriola @ 2020-12-13  5:06 UTC (permalink / raw)
  To: drbd-dev

This function lives in linux/blkdev.h

Signed-off-by: Michael D Labriola <michael.d.labriola@gmail.com>
---
 drbd/drbd-kernel-compat/tests/have_blkdev_get_by_path.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drbd/drbd-kernel-compat/tests/have_blkdev_get_by_path.c b/drbd/drbd-kernel-compat/tests/have_blkdev_get_by_path.c
index d0bae496..f795c1d1 100644
--- a/drbd/drbd-kernel-compat/tests/have_blkdev_get_by_path.c
+++ b/drbd/drbd-kernel-compat/tests/have_blkdev_get_by_path.c
@@ -1,4 +1,4 @@
-#include <linux/fs.h>
+#include <linux/blkdev.h>
 
 /*
  * In kernel version 2.6.38-rc1, open_bdev_exclusive() was replaced by
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Drbd-dev] [PATCH 3/8] drbd: don't include vermagic.h
  2020-12-13  5:06 [Drbd-dev] Get drbd-9.0 branch building with Linux 5.9 and 5.10 Michael D Labriola
  2020-12-13  5:06 ` [Drbd-dev] [PATCH 1/8] compat: fix include for submit_bio test Michael D Labriola
  2020-12-13  5:06 ` [Drbd-dev] [PATCH 2/8] compat: fix include for blkdev_get_by_path test Michael D Labriola
@ 2020-12-13  5:06 ` Michael D Labriola
  2020-12-13  5:07 ` [Drbd-dev] [PATCH 4/8] drbd: fix drbd_submit_bio argument handling Michael D Labriola
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Michael D Labriola @ 2020-12-13  5:06 UTC (permalink / raw)
  To: drbd-dev

Compilation fails because "This header can be included from kernel/module.c
or *.mod.c only".  Leaving it out seems to work just fine.

Signed-off-by: Michael D Labriola <michael.d.labriola@gmail.com>
---
 drbd/drbd_main.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drbd/drbd_main.c b/drbd/drbd_main.c
index 98a94a16..fe1a0b31 100644
--- a/drbd/drbd_main.c
+++ b/drbd/drbd_main.c
@@ -16,7 +16,6 @@
 #define pr_fmt(fmt)	KBUILD_MODNAME ": " fmt
 
 #include <linux/module.h>
-#include <linux/vermagic.h>
 #include <linux/jiffies.h>
 #include <linux/drbd.h>
 #include <linux/uaccess.h>
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Drbd-dev] [PATCH 4/8] drbd: fix drbd_submit_bio argument handling
  2020-12-13  5:06 [Drbd-dev] Get drbd-9.0 branch building with Linux 5.9 and 5.10 Michael D Labriola
                   ` (2 preceding siblings ...)
  2020-12-13  5:06 ` [Drbd-dev] [PATCH 3/8] drbd: don't include vermagic.h Michael D Labriola
@ 2020-12-13  5:07 ` Michael D Labriola
  2020-12-13  5:07 ` [Drbd-dev] [PATCH 5/8] drbd: use sock_set_keepalive() instead of kernel_setsockopt() Michael D Labriola
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Michael D Labriola @ 2020-12-13  5:07 UTC (permalink / raw)
  To: drbd-dev

Looks like we changed arguments from q to bio, but left the line that gets
device from q untouched.  Oopsie.

Signed-off-by: Michael D Labriola <michael.d.labriola@gmail.com>
---
 drbd/drbd_req.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drbd/drbd_req.c b/drbd/drbd_req.c
index 8db2a0e0..92b3b863 100644
--- a/drbd/drbd_req.c
+++ b/drbd/drbd_req.c
@@ -2196,7 +2196,7 @@ static bool drbd_fail_request_early(struct drbd_device *device, struct bio *bio)
 
 blk_qc_t drbd_submit_bio(struct bio *bio)
 {
-	struct drbd_device *device = (struct drbd_device *) q->queuedata;
+	struct drbd_device *device = bio->bi_disk->private_data;
 #ifdef CONFIG_DRBD_TIMING_STATS
 	ktime_t start_kt;
 #endif
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Drbd-dev] [PATCH 5/8] drbd: use sock_set_keepalive() instead of kernel_setsockopt()
  2020-12-13  5:06 [Drbd-dev] Get drbd-9.0 branch building with Linux 5.9 and 5.10 Michael D Labriola
                   ` (3 preceding siblings ...)
  2020-12-13  5:07 ` [Drbd-dev] [PATCH 4/8] drbd: fix drbd_submit_bio argument handling Michael D Labriola
@ 2020-12-13  5:07 ` Michael D Labriola
  2020-12-13  5:07 ` [Drbd-dev] [PATCH 6/8] drbd: get rid of set_fs() usage Michael D Labriola
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 10+ messages in thread
From: Michael D Labriola @ 2020-12-13  5:07 UTC (permalink / raw)
  To: drbd-dev

Looks like the rest of the code has been updated to use 5.8's sock_set_*
and tcp_set_* functions, but we've missed this one case.

Signed-off-by: Michael D Labriola <michael.d.labriola@gmail.com>
---
 drbd/drbd_transport_tcp.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drbd/drbd_transport_tcp.c b/drbd/drbd_transport_tcp.c
index 203dc4e0..3b1d4273 100644
--- a/drbd/drbd_transport_tcp.c
+++ b/drbd/drbd_transport_tcp.c
@@ -883,7 +883,6 @@ static int dtt_connect(struct drbd_transport *transport)
 	struct socket *dsocket, *csocket;
 	struct net_conf *nc;
 	int timeout, err;
-	int one = 1;
 	bool ok;
 
 	dsocket = NULL;
@@ -1065,9 +1064,7 @@ randomize:
 	dsocket->sk->sk_sndtimeo = timeout;
 	csocket->sk->sk_sndtimeo = timeout;
 
-	err = kernel_setsockopt(dsocket, SOL_SOCKET, SO_KEEPALIVE, (char *)&one, sizeof(one));
-	if (err)
-		tr_warn(transport, "Failed to enable SO_KEEPALIVE %d\n", err);
+	sock_set_keepalive(dsocket->sk);
 
 	return 0;
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Drbd-dev] [PATCH 6/8] drbd: get rid of set_fs() usage
  2020-12-13  5:06 [Drbd-dev] Get drbd-9.0 branch building with Linux 5.9 and 5.10 Michael D Labriola
                   ` (4 preceding siblings ...)
  2020-12-13  5:07 ` [Drbd-dev] [PATCH 5/8] drbd: use sock_set_keepalive() instead of kernel_setsockopt() Michael D Labriola
@ 2020-12-13  5:07 ` Michael D Labriola
  2020-12-13  5:07 ` [Drbd-dev] [PATCH 7/8] drbd: don't use sched_setscheduler() Michael D Labriola
  2020-12-13  5:07 ` [Drbd-dev] [PATCH 8/8] compat: remove set_bdi_cap_stable_writes Michael D Labriola
  7 siblings, 0 replies; 10+ messages in thread
From: Michael D Labriola @ 2020-12-13  5:07 UTC (permalink / raw)
  To: drbd-dev

5.10 is getting rid of set_fs().  When I went looking through git commits
to figure out how to properly protect sendpage, what I found was this
commit from 4.13:

    10428957 drbd: ->sendpage() never needed set_fs()

Signed-off-by: Michael D Labriola <michael.d.labriola@gmail.com>
---
 drbd/drbd_transport_tcp.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drbd/drbd_transport_tcp.c b/drbd/drbd_transport_tcp.c
index 3b1d4273..4e076460 100644
--- a/drbd/drbd_transport_tcp.c
+++ b/drbd/drbd_transport_tcp.c
@@ -1138,7 +1138,6 @@ static int dtt_send_page(struct drbd_transport *transport, enum drbd_stream stre
 	struct drbd_tcp_transport *tcp_transport =
 		container_of(transport, struct drbd_tcp_transport, transport);
 	struct socket *socket = tcp_transport->stream[stream];
-	mm_segment_t oldfs = get_fs();
 	int len = size;
 	int err = -EIO;
 
@@ -1147,7 +1146,6 @@ static int dtt_send_page(struct drbd_transport *transport, enum drbd_stream stre
 
 	msg_flags |= MSG_NOSIGNAL;
 	dtt_update_congested(tcp_transport);
-	set_fs(KERNEL_DS);
 	do {
 		int sent;
 
@@ -1173,7 +1171,6 @@ static int dtt_send_page(struct drbd_transport *transport, enum drbd_stream stre
 		 * and add that to the while() condition below.
 		 */
 	} while (len > 0 /* THINK && peer_device->repl_state[NOW] >= L_ESTABLISHED */);
-	set_fs(oldfs);
 	clear_bit(NET_CONGESTED, &tcp_transport->transport.flags);
 
 	if (len == 0)
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Drbd-dev] [PATCH 7/8] drbd: don't use sched_setscheduler()
  2020-12-13  5:06 [Drbd-dev] Get drbd-9.0 branch building with Linux 5.9 and 5.10 Michael D Labriola
                   ` (5 preceding siblings ...)
  2020-12-13  5:07 ` [Drbd-dev] [PATCH 6/8] drbd: get rid of set_fs() usage Michael D Labriola
@ 2020-12-13  5:07 ` Michael D Labriola
  2020-12-13  5:07 ` [Drbd-dev] [PATCH 8/8] compat: remove set_bdi_cap_stable_writes Michael D Labriola
  7 siblings, 0 replies; 10+ messages in thread
From: Michael D Labriola @ 2020-12-13  5:07 UTC (permalink / raw)
  To: drbd-dev

The sched_setscheduler() function was removed in 5.9.  Use
sched_set_fifo_low() like the mainline drbd8 module did here:

    c9ec0524 sched,drbd: Convert to sched_set_fifo*()

Signed-off-by: Michael D Labriola <michael.d.labriola@gmail.com>
---
 drbd/drbd_receiver.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drbd/drbd_receiver.c b/drbd/drbd_receiver.c
index 46368949..6fb2ec39 100644
--- a/drbd/drbd_receiver.c
+++ b/drbd/drbd_receiver.c
@@ -9390,13 +9390,10 @@ int drbd_ack_receiver(struct drbd_thread *thi)
 	unsigned int header_size = drbd_header_size(connection);
 	int expect   = header_size;
 	bool ping_timeout_active = false;
-	struct sched_param param = { .sched_priority = 2 };
 	struct drbd_transport *transport = &connection->transport;
 	struct drbd_transport_ops *tr_ops = transport->ops;
 
-	rv = sched_setscheduler(current, SCHED_RR, &param);
-	if (rv < 0)
-		drbd_err(connection, "drbd_ack_receiver: ERROR set priority, ret=%d\n", rv);
+	sched_set_fifo_low(current);
 
 	while (get_t_state(thi) == RUNNING) {
 		drbd_thread_current_set_cpu(thi);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Drbd-dev] [PATCH 8/8] compat: remove set_bdi_cap_stable_writes
  2020-12-13  5:06 [Drbd-dev] Get drbd-9.0 branch building with Linux 5.9 and 5.10 Michael D Labriola
                   ` (6 preceding siblings ...)
  2020-12-13  5:07 ` [Drbd-dev] [PATCH 7/8] drbd: don't use sched_setscheduler() Michael D Labriola
@ 2020-12-13  5:07 ` Michael D Labriola
  7 siblings, 0 replies; 10+ messages in thread
From: Michael D Labriola @ 2020-12-13  5:07 UTC (permalink / raw)
  To: drbd-dev

BDI_CAP_STABLE_WRITES goes away in 5.10, resulting in tons of warnings at
compile time.  It doesn't look like anything in either drbd or drbd-utils
is using the resulting set_bdi_cap_stable_writes macro anyways, so this
commit removes it.

Signed-off-by: Michael D Labriola <michael.d.labriola@gmail.com>
---
 drbd/drbd-kernel-compat/drbd_wrappers.h | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drbd/drbd-kernel-compat/drbd_wrappers.h b/drbd/drbd-kernel-compat/drbd_wrappers.h
index c0d8981c..01fdbf22 100644
--- a/drbd/drbd-kernel-compat/drbd_wrappers.h
+++ b/drbd/drbd-kernel-compat/drbd_wrappers.h
@@ -127,13 +127,6 @@ static inline void blk_queue_write_cache(struct request_queue *q, bool enabled,
 #define KREF_INIT(N) { ATOMIC_INIT(N) }
 #endif
 
-#ifdef BDI_CAP_STABLE_WRITES /* >= v3.9 */
-#define set_bdi_cap_stable_writes(cap)	do { (cap) |= BDI_CAP_STABLE_WRITES; } while (0)
-#else /* < v3.9 */
-#warning "BDI_CAP_STABLE_WRITES not available"
-#define set_bdi_cap_stable_writes(cap)	do { } while (0)
-#endif
-
 #ifdef COMPAT_HAVE_POINTER_BACKING_DEV_INFO /* >= v4.11 */
 #define bdi_from_device(device) (device->ldev->backing_bdev->bd_disk->queue->backing_dev_info)
 #else /* < v4.11 */
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [Drbd-dev] [PATCH 1/8] compat: fix include for submit_bio test
  2020-12-13  5:58 [Drbd-dev] Get drbd-9.0 branch building with Linux 5.9 and 5.10 Michael D Labriola
@ 2020-12-13  5:58 ` Michael D Labriola
  0 siblings, 0 replies; 10+ messages in thread
From: Michael D Labriola @ 2020-12-13  5:58 UTC (permalink / raw)
  To: drbd-dev

Looks like this test is including the wrong header to get at struct
block_device_operations.

Signed-off-by: Michael D Labriola <michael.d.labriola@gmail.com>
---
 drbd/drbd-kernel-compat/tests/have_submit_bio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drbd/drbd-kernel-compat/tests/have_submit_bio.c b/drbd/drbd-kernel-compat/tests/have_submit_bio.c
index 26bc7e8c..ca94cd27 100644
--- a/drbd/drbd-kernel-compat/tests/have_submit_bio.c
+++ b/drbd/drbd-kernel-compat/tests/have_submit_bio.c
@@ -1,6 +1,6 @@
 /* { "version": "v5.8", "commit": "c62b37d96b6eb3ec5ae4cbe00db107bf15aebc93", "comment": "Since 5.8 make_request_fn has been replaced by a block_device_operations method called submit_bio", "author": "Christoph Hellwig <hch@lst.de>", "date": "Wed Jul 1 10:59:43 2020 +0200" } */
 
-#include <linux/blk_types.h>
+#include <linux/blkdev.h>
 
 void foo(struct block_device_operations *ops)
 {
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-12-13  5:59 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-13  5:06 [Drbd-dev] Get drbd-9.0 branch building with Linux 5.9 and 5.10 Michael D Labriola
2020-12-13  5:06 ` [Drbd-dev] [PATCH 1/8] compat: fix include for submit_bio test Michael D Labriola
2020-12-13  5:06 ` [Drbd-dev] [PATCH 2/8] compat: fix include for blkdev_get_by_path test Michael D Labriola
2020-12-13  5:06 ` [Drbd-dev] [PATCH 3/8] drbd: don't include vermagic.h Michael D Labriola
2020-12-13  5:07 ` [Drbd-dev] [PATCH 4/8] drbd: fix drbd_submit_bio argument handling Michael D Labriola
2020-12-13  5:07 ` [Drbd-dev] [PATCH 5/8] drbd: use sock_set_keepalive() instead of kernel_setsockopt() Michael D Labriola
2020-12-13  5:07 ` [Drbd-dev] [PATCH 6/8] drbd: get rid of set_fs() usage Michael D Labriola
2020-12-13  5:07 ` [Drbd-dev] [PATCH 7/8] drbd: don't use sched_setscheduler() Michael D Labriola
2020-12-13  5:07 ` [Drbd-dev] [PATCH 8/8] compat: remove set_bdi_cap_stable_writes Michael D Labriola
  -- strict thread matches above, loose matches on Subject: below --
2020-12-13  5:58 [Drbd-dev] Get drbd-9.0 branch building with Linux 5.9 and 5.10 Michael D Labriola
2020-12-13  5:58 ` [Drbd-dev] [PATCH 1/8] compat: fix include for submit_bio test Michael D Labriola

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox