Get drbd-9.0 branch building with Linux 5.9 and 5.10
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.
PATCH 1/8 compat: fix include for submit_bio test
Looks like this test is including the wrong header to get at struct block_device_operations.
--- drbd/drbd-kernel-compat/tests/have_submit_bio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drbd/drbd-kernel-compat/tests/have_submit_bio.c +1 -1
@@ -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 <[email protected]>", "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) {
Signature · 1 line
2.17.1
PATCH 2/8 compat: fix include for blkdev_get_by_path test
In reply to Michael D LabriolaThis function lives in linux/blkdev.h
--- drbd/drbd-kernel-compat/tests/have_blkdev_get_by_path.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drbd/drbd-kernel-compat/tests/have_blkdev_get_by_path.c +1 -1
@@ -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
Signature · 1 line
2.17.1
PATCH 3/8 drbd: don't include vermagic.h
In reply to Michael D LabriolaCompilation fails because "This header can be included from kernel/module.c or *.mod.c only". Leaving it out seems to work just fine.
--- drbd/drbd_main.c | 1 - 1 file changed, 1 deletion(-)
drbd/drbd_main.c +0 -1
@@ -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>
Signature · 1 line
2.17.1
PATCH 4/8 drbd: fix drbd_submit_bio argument handling
In reply to Michael D LabriolaLooks like we changed arguments from q to bio, but left the line that gets device from q untouched. Oopsie.
--- drbd/drbd_req.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drbd/drbd_req.c +1 -1
@@ -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
Signature · 1 line
2.17.1
PATCH 5/8 drbd: use sock_set_keepalive() instead of kernel_setsockopt()
In reply to Michael D LabriolaLooks 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.
--- drbd/drbd_transport_tcp.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drbd/drbd_transport_tcp.c +1 -4
@@ -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 ;
Signature · 1 line
2.17.1
PATCH 6/8 drbd: get rid of set_fs() usage
In reply to Michael D Labriola5.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()
--- drbd/drbd_transport_tcp.c | 3 --- 1 file changed, 3 deletions(-)
drbd/drbd_transport_tcp.c +0 -3
@@ -1138,7 +1138,6 @@ static int dtt_send_page(struct drbd_transport *transport, enum drbd_stream strestruct 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 )
Signature · 1 line
2.17.1
PATCH 7/8 drbd: don't use sched_setscheduler()
In reply to Michael D LabriolaThe 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*()
--- drbd/drbd_receiver.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drbd/drbd_receiver.c +1 -4
@@ -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 , ¶m); -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);
Signature · 1 line
2.17.1
PATCH 8/8 compat: remove set_bdi_cap_stable_writes
In reply to Michael D LabriolaBDI_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.
--- drbd/drbd-kernel-compat/drbd_wrappers.h | 7 ------- 1 file changed, 7 deletions(-)
drbd/drbd-kernel-compat/drbd_wrappers.h +0 -7
@@ -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 */
Signature · 1 line
2.17.1
Christoph Böhmwalder
maintainerHi Michael,
Thanks for this great contribution!
Unfortunately, we duplicated some work here, but neither of us could have known that :)
Over the last few days I fabricated some patches that fix some of the same problems, ultimately leading to the same result.
I'll review your patches – on first glance it seems like some of your approaches may actually be better than mine. If the patches are exactly the same, I'll attribute you since you published your patches first. I'll mix and match with my patches, since they are more thorough in some places (for example, I did go to the trouble of creating a compat test for sched_setscheduler()).
Some of these patches are still under internal review, so this may take some time, but I'll let you know which of yours I chose.
Thanks again!
--
Christoph Böhmwalder
LINBIT | Keeping the Digital World Running DRBD HA — Disaster Recovery — Software defined Storage
Quoted 21 lines · Michael D Labriola
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()tosched_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.
_______________________________________________
drbd-dev mailing list
[email protected]
https://lists.linbit.com/mailman/listinfo/drbd-dev
Thanks, Christoph. I've been using DRBD for 15+ years, so it's about time I officially contributed something other than bug reports. ;-)
Quoted 49 lines · Christoph Böhmwalder
Hi Michael,
Thanks for this great contribution!
Unfortunately, we duplicated some work here, but neither of us could have known that :)
Over the last few days I fabricated some patches that fix some of the same problems, ultimately leading to the same result.I'll review your patches – on first glance it seems like some of your approaches may actually be better than mine. If the patches are exactly the same, I'll attribute you since you published your patches first. I'll mix and match with my patches, since they are more thorough in some places (for example, I did go to the trouble of creating a compat test for
sched_setscheduler()).Some of these patches are still under internal review, so this may take some time, but I'll let you know which of yours I chose.
Thanks again!
--
Christoph Böhmwalder
LINBIT | Keeping the Digital World Running DRBD HA — Disaster Recovery — Software defined StorageQuoted 21 lines · Michael D Labriola
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()tosched_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.
_______________________________________________
drbd-dev mailing list
[email protected]
https://lists.linbit.com/mailman/listinfo/drbd-dev
Signature · 4 lines
Michael D Labriola 21 Rip Van Winkle Cir Warwick, RI 02886 401-316-9844 (cell)