[DRBD-user] 9.0.28 fails to build on centos-8-stream

Lars Ellenberg lars.ellenberg at linbit.com
Mon Mar 1 11:44:02 CET 2021

On Fri, Feb 26, 2021 at 07:09:29AM +0100, Fabio M. Di Nitto wrote:
> hey guys,
> similar to 9.0.27, log below.
> Any chance you can give me a quick and dirty fix?

>   CC [M]  /builddir/build/BUILD/drbd-9.0.28-1/drbd/drbd_main.o
> /builddir/build/BUILD/drbd-9.0.28-1/drbd/drbd_main.c: In function
> 'drbd_create_device':
> /builddir/build/BUILD/drbd-9.0.28-1/drbd/drbd_main.c:3729:6: error: implicit
> declaration of function 'blk_alloc_queue'; did you mean
> 'blk_alloc_queue_rh'? [-Werror=implicit-function-declaration]
>   q = blk_alloc_queue(drbd_make_request, NUMA_NO_NODE);
>       ^~~~~~~~~~~~~~~
>       blk_alloc_queue_rh

A short history of blk_alloc_queue():

Jens introduced it with v2.6.0:
2003-08-06  ace416a37a95 axboe at suse.de [PATCH] Proper block queue reference counting
+request_queue_t *blk_alloc_queue(int);

somewhere in between, 2.6.16.xyz
... int -> gfp_t, request_queue_t -> struct request_queue

Centos 8 Stream "nominal base" is 4.18... which is still
+struct request_queue *blk_alloc_queue(gfp_t);

with v5.6:
2020-03-27  3d745ea5b095 hch at lst.de block: simplify queue allocation
-struct request_queue *blk_alloc_queue(gfp_t);
+struct request_queue *blk_alloc_queue(make_request_fn make_request, int node_id);

with v5.8:
2020-07-01  c62b37d96b6e hch at lst.de block: move ->make_request_fn to struct block_device_operations
-struct request_queue *blk_alloc_queue(make_request_fn make_request, int node_id);
+struct request_queue *blk_alloc_queue(int node_id);

"Centos Stream" is patched 4.18, so it started out with 
+struct request_queue *blk_alloc_queue(gfp_t);
and since that is in the kABI whitelist, they cannot change that.

Still they want to backport the upstream changes up to
+struct request_queue *blk_alloc_queue(make_request_fn make_request, int node_id);
which changes the pattern of [**]
 q = blk_alloc_queue(gfp_t)
 blk_queue_make_request(q, fn)
 q = blk_alloc_queue(fn, NUMA_NO_NODE)

They want that backport, because that was a pre-requisite to get rid of some
indirect call in the hot path of block-mq, which due to spectre mitigations was
costly enough to make a difference.

Which means Centost stream needs to preserve the "old" kABI white-listed
blk_alloc_queue(gfp_t), and also keep the blk_queue_make_request(q,fn),
under those very symbol names.
But at the same time introduce the "new" one.

Which they do by dropping the declaration of the old one from the headers
(that's fine. the B in kABI is for binary, not for header files...)
but keeping the symbols defined and exported
(so old binary drivers supposedly will keep working)

And introduce the new API as blk_alloc_queue_*rh*(fn, node_id)

Signature with v5.8 reverts back full circle to 
+struct request_queue *blk_alloc_queue(int);
(though now that int is NUMA node id and not gfp flag...)
Yay, more compat gussing fun ;-)

Our compat code detects this, by testing for ops->submit_bio,
and patches down from v5.8 style to v5.6 style,
then checks for (gfp_t) vs (fn, node_id) by checking for compile-time
availability of blk_queue_make_request(q,fn),
and would patches based on the above pattern [**].
But since it is NOT available, it does not.

But we do not yet detect this weird "changed sybol name for compat" thing.

Guess we need an extra test for "blk_alloc_queue_rh()",
and an extra compat patch :-(

Meanwhile, you can just add an extra sed statement.


More information about the drbd-user mailing list