From 1eb6b25c2a8212af3c9d1b817f972b21a470e6dd8172b4bab26c720a6e771e79 Mon Sep 17 00:00:00 2001 From: Roger Zhou Date: Sat, 9 Jul 2022 00:28:28 +0000 Subject: [PATCH 1/2] Accepting request 987977 from home:hmzhao:branches:network:ha-clustering:Factory - drbd: build error against kernel v5.18 (bsc#1201335) - remove patch: move_bdi_from_request_queue_to_gendisk - change exist patches name from bsc#1192929: old name: make_block_holder_optional.patch move_kvmalloc_related_to_slab.patch polling_to_bio_base.patch pass_gend_to_blk_queue_update_readahead.patch dax_support.patch add_disk_error_handle.patch have_void_drbd_submit_bio.patch remove_bdgrab.patch new name: bsc-1192929_01-make_block_holder_optional.patch bsc-1192929_02-move_kvmalloc_related_to_slab.patch bsc-1192929_03-polling_to_bio_base.patch bsc-1192929_04-pass_gend_to_blk_queue_update_readahead.patch bsc-1192929_06-dax_support.patch bsc-1192929_07-add_disk_error_handle.patch bsc-1192929_08-have_void_drbd_submit_bio.patch bsc-1192929_09-remove_bdgrab.patch - add patch: + bsc-1201335_01-compat-test-and-cocci-patch-for-bdi-in-gendisk.patch + bsc-1201335_02-0001-compat-only-apply-bdi-pointer-patch-if-bdi-is-in-req.patch + bsc-1201335_03-genhd.patch + bsc-1201335_04-bio_alloc_bioset.patch + bsc-1201335_05-bio_alloc.patch + bsc-1201335_06-bdi.patch + bsc-1201335_07-write-same.patch + bsc-1201335_08-bio_clone_fast.patch OBS-URL: https://build.opensuse.org/request/show/987977 OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/drbd?expand=0&rev=137 --- ...192929_01-make_block_holder_optional.patch | 0 ...929_02-move_kvmalloc_related_to_slab.patch | 0 ...> bsc-1192929_03-polling_to_bio_base.patch | 0 ...s_gend_to_blk_queue_update_readahead.patch | 0 ....patch => bsc-1192929_06-dax_support.patch | 0 ...bsc-1192929_07-add_disk_error_handle.patch | 0 ...1192929_08-have_void_drbd_submit_bio.patch | 0 ...atch => bsc-1192929_09-remove_bdgrab.patch | 0 ...t-and-cocci-patch-for-bdi-in-gendisk.patch | 55 ++++++++ ...y-bdi-pointer-patch-if-bdi-is-in-req.patch | 37 ++++++ bsc-1201335_03-genhd.patch | 102 +++++++++++++++ bsc-1201335_04-bio_alloc_bioset.patch | 79 ++++++++++++ bsc-1201335_05-bio_alloc.patch | 70 +++++++++++ bsc-1201335_06-bdi.patch | 117 ++++++++++++++++++ bsc-1201335_07-write-same.patch | 28 +++++ bsc-1201335_08-bio_clone_fast.patch | 30 +++++ drbd.changes | 34 +++++ drbd.spec | 36 ++++-- move_bdi_from_request_queue_to_gendisk.patch | 84 ------------- 19 files changed, 578 insertions(+), 94 deletions(-) rename make_block_holder_optional.patch => bsc-1192929_01-make_block_holder_optional.patch (100%) rename move_kvmalloc_related_to_slab.patch => bsc-1192929_02-move_kvmalloc_related_to_slab.patch (100%) rename polling_to_bio_base.patch => bsc-1192929_03-polling_to_bio_base.patch (100%) rename pass_gend_to_blk_queue_update_readahead.patch => bsc-1192929_04-pass_gend_to_blk_queue_update_readahead.patch (100%) rename dax_support.patch => bsc-1192929_06-dax_support.patch (100%) rename add_disk_error_handle.patch => bsc-1192929_07-add_disk_error_handle.patch (100%) rename have_void_drbd_submit_bio.patch => bsc-1192929_08-have_void_drbd_submit_bio.patch (100%) rename remove_bdgrab.patch => bsc-1192929_09-remove_bdgrab.patch (100%) create mode 100644 bsc-1201335_01-compat-test-and-cocci-patch-for-bdi-in-gendisk.patch create mode 100644 bsc-1201335_02-compat-only-apply-bdi-pointer-patch-if-bdi-is-in-req.patch create mode 100644 bsc-1201335_03-genhd.patch create mode 100644 bsc-1201335_04-bio_alloc_bioset.patch create mode 100644 bsc-1201335_05-bio_alloc.patch create mode 100644 bsc-1201335_06-bdi.patch create mode 100644 bsc-1201335_07-write-same.patch create mode 100644 bsc-1201335_08-bio_clone_fast.patch delete mode 100644 move_bdi_from_request_queue_to_gendisk.patch diff --git a/make_block_holder_optional.patch b/bsc-1192929_01-make_block_holder_optional.patch similarity index 100% rename from make_block_holder_optional.patch rename to bsc-1192929_01-make_block_holder_optional.patch diff --git a/move_kvmalloc_related_to_slab.patch b/bsc-1192929_02-move_kvmalloc_related_to_slab.patch similarity index 100% rename from move_kvmalloc_related_to_slab.patch rename to bsc-1192929_02-move_kvmalloc_related_to_slab.patch diff --git a/polling_to_bio_base.patch b/bsc-1192929_03-polling_to_bio_base.patch similarity index 100% rename from polling_to_bio_base.patch rename to bsc-1192929_03-polling_to_bio_base.patch diff --git a/pass_gend_to_blk_queue_update_readahead.patch b/bsc-1192929_04-pass_gend_to_blk_queue_update_readahead.patch similarity index 100% rename from pass_gend_to_blk_queue_update_readahead.patch rename to bsc-1192929_04-pass_gend_to_blk_queue_update_readahead.patch diff --git a/dax_support.patch b/bsc-1192929_06-dax_support.patch similarity index 100% rename from dax_support.patch rename to bsc-1192929_06-dax_support.patch diff --git a/add_disk_error_handle.patch b/bsc-1192929_07-add_disk_error_handle.patch similarity index 100% rename from add_disk_error_handle.patch rename to bsc-1192929_07-add_disk_error_handle.patch diff --git a/have_void_drbd_submit_bio.patch b/bsc-1192929_08-have_void_drbd_submit_bio.patch similarity index 100% rename from have_void_drbd_submit_bio.patch rename to bsc-1192929_08-have_void_drbd_submit_bio.patch diff --git a/remove_bdgrab.patch b/bsc-1192929_09-remove_bdgrab.patch similarity index 100% rename from remove_bdgrab.patch rename to bsc-1192929_09-remove_bdgrab.patch diff --git a/bsc-1201335_01-compat-test-and-cocci-patch-for-bdi-in-gendisk.patch b/bsc-1201335_01-compat-test-and-cocci-patch-for-bdi-in-gendisk.patch new file mode 100644 index 0000000..2846102 --- /dev/null +++ b/bsc-1201335_01-compat-test-and-cocci-patch-for-bdi-in-gendisk.patch @@ -0,0 +1,55 @@ +From 25592a4a902415cf1a353a1e26ba11b4ccc0eca7 Mon Sep 17 00:00:00 2001 +From: +Date: Wed, 6 Apr 2022 12:27:36 +0200 +Subject: [PATCH] compat: test and cocci patch for bdi in gendisk + +--- + .../cocci/struct_gendisk__no_has_backing_dev_info.cocci | 6 ++++++ + drbd/drbd-kernel-compat/gen_patch_names.c | 3 +++ + .../tests/struct_gendisk_has_backing_dev_info.c | 8 ++++++++ + 3 files changed, 17 insertions(+) + create mode 100644 drbd/drbd-kernel-compat/cocci/struct_gendisk__no_has_backing_dev_info.cocci + create mode 100644 drbd/drbd-kernel-compat/tests/struct_gendisk_has_backing_dev_info.c + +diff --git a/drbd/drbd-kernel-compat/cocci/struct_gendisk__no_has_backing_dev_info.cocci b/drbd/drbd-kernel-compat/cocci/struct_gendisk__no_has_backing_dev_info.cocci +new file mode 100644 +index 000000000000..b3d290710ee8 +--- /dev/null ++++ b/drbd/drbd-kernel-compat/cocci/struct_gendisk__no_has_backing_dev_info.cocci +@@ -0,0 +1,6 @@ ++@@ ++struct drbd_device *d; ++@@ ++d->ldev->backing_bdev-> ++- bd_disk->bdi +++ bd_disk->queue->backing_dev_info +diff -Nupr a/drbd/drbd-kernel-compat/gen_patch_names.c b/drbd/drbd-kernel-compat/gen_patch_names.c +--- a/drbd/drbd-kernel-compat/gen_patch_names.c 2022-07-08 19:43:37.106735503 +0800 ++++ b/drbd/drbd-kernel-compat/gen_patch_names.c 2022-07-08 19:45:17.570310319 +0800 +@@ -396,6 +396,9 @@ int main(int argc, char **argv) + COMPAT_HAVE_BLK_QUEUE_UPDATE_READAHEAD, "present"); + #endif + ++ patch(1, "struct_gendisk", true, false, ++ COMPAT_STRUCT_GENDISK_HAS_BACKING_DEV_INFO, "has_backing_dev_info"); ++ + patch(1, "backing_dev_info", true, false, + COMPAT_HAVE_POINTER_BACKING_DEV_INFO, "is_pointer"); + +diff --git a/drbd/drbd-kernel-compat/tests/struct_gendisk_has_backing_dev_info.c b/drbd/drbd-kernel-compat/tests/struct_gendisk_has_backing_dev_info.c +new file mode 100644 +index 000000000000..cd40214a564c +--- /dev/null ++++ b/drbd/drbd-kernel-compat/tests/struct_gendisk_has_backing_dev_info.c +@@ -0,0 +1,8 @@ ++/* { "version": "v5.15-rc1", "commit": "21cf866145047f8bfecb38ec8d2fed64464c074f", "comment": "The backing_dev_info was moved from request_queue to backing_dev_info", "author": "Christoph Hellwig ", "date": "Wed Jul 1 11:06:22 2020 +0200" } */ ++ ++#include ++ ++struct backing_dev_info *foo(struct gendisk *d) ++{ ++ return d->bdi; ++} +-- +2.34.1 + diff --git a/bsc-1201335_02-compat-only-apply-bdi-pointer-patch-if-bdi-is-in-req.patch b/bsc-1201335_02-compat-only-apply-bdi-pointer-patch-if-bdi-is-in-req.patch new file mode 100644 index 0000000..e8a3620 --- /dev/null +++ b/bsc-1201335_02-compat-only-apply-bdi-pointer-patch-if-bdi-is-in-req.patch @@ -0,0 +1,37 @@ +From eacd74206a8f48c3861de2096215790426331237 Mon Sep 17 00:00:00 2001 +From: +Date: Wed, 6 Apr 2022 13:36:08 +0200 +Subject: [PATCH] compat: only apply bdi pointer patch if bdi is in + request_queue + +The history is as follows: + +1. In the beginning, request_queue.backing_dev_info was a regular member +2. Then, backing_dev_info became a pointer +3. Now the backing_dev_info pointer has moved to gendisk.bdi + +So there is never a case where gendisk has a non-pointer +backing_dev_info. Thus, we only want to apply the pointer patch for old +kernels where backing_dev_info was still in request_queue. +--- + drbd/drbd-kernel-compat/gen_patch_names.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drbd/drbd-kernel-compat/gen_patch_names.c b/drbd/drbd-kernel-compat/gen_patch_names.c +index 9210d2c2eeb9..763652a8908b 100644 +--- a/drbd/drbd-kernel-compat/gen_patch_names.c ++++ b/drbd/drbd-kernel-compat/gen_patch_names.c +@@ -400,8 +400,10 @@ int main(int argc, char **argv) + patch(1, "struct_gendisk", true, false, + COMPAT_STRUCT_GENDISK_HAS_BACKING_DEV_INFO, "has_backing_dev_info"); + ++#if !defined(COMPAT_STRUCT_GENDISK_HAS_BACKING_DEV_INFO) + patch(1, "backing_dev_info", true, false, + COMPAT_HAVE_POINTER_BACKING_DEV_INFO, "is_pointer"); ++#endif + + patch(1, "sendpage_ok", true, false, + COMPAT_HAVE_SENDPAGE_OK, "present"); +-- +2.34.1 + diff --git a/bsc-1201335_03-genhd.patch b/bsc-1201335_03-genhd.patch new file mode 100644 index 0000000..71d6907 --- /dev/null +++ b/bsc-1201335_03-genhd.patch @@ -0,0 +1,102 @@ +/* this patch is related with following upstream kernel commit */ + +commit 322cbb50de711814c42fb088f6d31901502c711a +Author: Christoph Hellwig +Date: Mon Jan 24 10:39:13 2022 +0100 + + block: remove genhd.h + + There is no good reason to keep genhd.h separate from the main blkdev.h + header that includes it. So fold the contents of genhd.h into blkdev.h + and remove genhd.h entirely. + + Signed-off-by: Christoph Hellwig + Reviewed-by: Chaitanya Kulkarni + Reviewed-by: Martin K. Petersen + Link: https://lore.kernel.org/r/20220124093913.742411-4-hch@lst.de + Signed-off-by: Jens Axboe +--- + +diff -Nupr a/drbd/drbd-kernel-compat/tests/have_atomic_in_flight.c b/drbd/drbd-kernel-compat/tests/have_atomic_in_flight.c +--- a/drbd/drbd-kernel-compat/tests/have_atomic_in_flight.c 2022-07-07 16:50:27.736823224 +0800 ++++ b/drbd/drbd-kernel-compat/tests/have_atomic_in_flight.c 2022-07-08 18:27:01.362626866 +0800 +@@ -1,6 +1,6 @@ + #include + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,39) +-#include ++#include + + #ifndef __same_type + # define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) +diff -Nupr a/drbd/drbd-kernel-compat/tests/have_bd_unlink_disk_holder.c b/drbd/drbd-kernel-compat/tests/have_bd_unlink_disk_holder.c +--- a/drbd/drbd-kernel-compat/tests/have_bd_unlink_disk_holder.c 2022-07-07 16:50:35.476788526 +0800 ++++ b/drbd/drbd-kernel-compat/tests/have_bd_unlink_disk_holder.c 2022-07-07 16:52:09.432367225 +0800 +@@ -1,4 +1,3 @@ +-#include + #include + #include + +diff -Nupr a/drbd/drbd-kernel-compat/tests/have_blk_alloc_disk.c b/drbd/drbd-kernel-compat/tests/have_blk_alloc_disk.c +--- a/drbd/drbd-kernel-compat/tests/have_blk_alloc_disk.c 2022-07-07 16:50:42.400757477 +0800 ++++ b/drbd/drbd-kernel-compat/tests/have_blk_alloc_disk.c 2022-07-08 18:27:51.914415515 +0800 +@@ -1,6 +1,6 @@ + /* { "version": "v5.13-rc4", "commit": "b647ad024841d02d67e78716f51f355d8d3e9656", "comment": "5.13 introduces a blk_alloc_disk helper", "author": "Christoph Hellwig ", "date": "Fri May 21 07:50:57 2021 +0200" } */ + +-#include ++#include + + struct gendisk *foo(int node) + { +diff -Nupr a/drbd/drbd-kernel-compat/tests/have_disk_update_readahead.c b/drbd/drbd-kernel-compat/tests/have_disk_update_readahead.c +--- a/drbd/drbd-kernel-compat/tests/have_disk_update_readahead.c 2022-07-08 20:00:47.590378757 +0800 ++++ b/drbd/drbd-kernel-compat/tests/have_disk_update_readahead.c 2022-07-08 20:01:47.462126256 +0800 +@@ -1,6 +1,5 @@ + /* { "version": "v5.16", "commit": "471aa704db4904f7af5a50019ca3b5b018c0cf62", "comment": "block: pass a gendisk to blk_queue_update_readahead", "author": "Christoph Hellwig ", "date": "Mon Aug 9 16:17:41 2021 +0200" } */ + +-#include + #include + + void foo(struct gendisk *d) +diff -Nupr a/drbd/drbd-kernel-compat/tests/have_hd_struct.c b/drbd/drbd-kernel-compat/tests/have_hd_struct.c +--- a/drbd/drbd-kernel-compat/tests/have_hd_struct.c 2022-07-07 16:51:01.344672526 +0800 ++++ b/drbd/drbd-kernel-compat/tests/have_hd_struct.c 2022-07-08 18:31:19.633543494 +0800 +@@ -1,5 +1,6 @@ + /* { "version": "v5.10-rc5", "commit": "0d02129e76edf91cf04fabf1efbc3a9a1f1d729a", "comment": "struct hd_struct was merged into struct block_device", "author": "Christoph Hellwig ", "date": "Fri Nov 27 16:43:51 2020 +0100" } */ + + #include ++#include + + struct hd_struct hd; +diff -Nupr a/drbd/drbd-kernel-compat/tests/have_revalidate_disk_size.c b/drbd/drbd-kernel-compat/tests/have_revalidate_disk_size.c +--- a/drbd/drbd-kernel-compat/tests/have_revalidate_disk_size.c 2022-07-07 16:51:06.892647651 +0800 ++++ b/drbd/drbd-kernel-compat/tests/have_revalidate_disk_size.c 2022-07-08 18:28:55.114151284 +0800 +@@ -1,6 +1,6 @@ + /* { "version": "v5.9-rc4", "commit": "659e56ba864d37b7ee0a49cd432205b2a5ca815e", "comment": "The revalidate_disk_size helper was added in v5.9-rc4", "author": "Christoph Hellwig ", "date": "Tue Sep 1 17:57:43 2020 +0200" } */ + +-#include ++#include + + void foo(struct gendisk *disk) + { +diff -Nupr a/drbd/drbd-kernel-compat/tests/have_set_capacity_and_notify.c b/drbd/drbd-kernel-compat/tests/have_set_capacity_and_notify.c +--- a/drbd/drbd-kernel-compat/tests/have_set_capacity_and_notify.c 2022-07-07 16:51:12.376623066 +0800 ++++ b/drbd/drbd-kernel-compat/tests/have_set_capacity_and_notify.c 2022-07-08 18:29:26.082021496 +0800 +@@ -1,6 +1,6 @@ + /* { "version": "v5.10-rc5", "commit": "449f4ec9892ebc2f37a7eae6d97db2cf7c65e09a", "comment": "New (as far as DRBD is concerned) helper set_capacity_and_notify", "author": "Christoph Hellwig ", "date": "Mon Nov 16 15:56:56 2020 +0100" } */ + +-#include ++#include + + bool foo(struct gendisk *disk, sector_t size) + { +diff -Nupr a/drbd/drbd_int.h b/drbd/drbd_int.h +--- a/drbd/drbd_int.h 2022-07-07 16:50:13.032889154 +0800 ++++ b/drbd/drbd_int.h 2022-07-07 16:51:38.292506862 +0800 +@@ -28,7 +28,6 @@ + #include + #include + #include +-#include + #include + #include + #include diff --git a/bsc-1201335_04-bio_alloc_bioset.patch b/bsc-1201335_04-bio_alloc_bioset.patch new file mode 100644 index 0000000..0865ff4 --- /dev/null +++ b/bsc-1201335_04-bio_alloc_bioset.patch @@ -0,0 +1,79 @@ +/* This patch is related with following upstream kernel commit */ + +commit 609be1066731fea86436f5f91022f82e592ab456 +Author: Christoph Hellwig +Date: Mon Jan 24 10:11:03 2022 +0100 + + block: pass a block_device and opf to bio_alloc_bioset + + Pass the block_device and operation that we plan to use this bio for to + bio_alloc_bioset to optimize the assigment. NULL/0 can be passed, both + for the passthrough case on a raw request_queue and to temporarily avoid + refactoring some nasty code. + + Also move the gfp_mask argument after the nr_vecs argument for a much + more logical calling convention matching what most of the kernel does. + + Signed-off-by: Christoph Hellwig + Reviewed-by: Chaitanya Kulkarni + Link: https://lore.kernel.org/r/20220124091107.642561-16-hch@lst.de + Signed-off-by: Jens Axboe +--- + +diff -Nupr a/drbd/drbd_actlog.c b/drbd/drbd_actlog.c +--- a/drbd/drbd_actlog.c 2022-07-07 18:23:47.643895879 +0800 ++++ b/drbd/drbd_actlog.c 2022-07-08 06:46:56.597471149 +0800 +@@ -94,8 +94,8 @@ static int _drbd_md_sync_page_io(struct + device->md_io.done = 0; + device->md_io.error = -ENODEV; + +- bio = bio_alloc_bioset(GFP_NOIO, 1, &drbd_md_io_bio_set); +- bio_set_dev(bio, bdev->md_bdev); ++ bio = bio_alloc_bioset(bdev->md_bdev, 1, op | op_flags, GFP_NOIO, ++ &drbd_md_io_bio_set); + bio->bi_iter.bi_sector = sector; + err = -EIO; + if (bio_add_page(bio, device->md_io.page, size, 0) != size) +@@ -103,8 +103,6 @@ static int _drbd_md_sync_page_io(struct + bio->bi_private = device; + bio->bi_end_io = drbd_md_endio; + +- bio->bi_opf = op | op_flags; +- + if (op != REQ_OP_WRITE && device->disk_state[NOW] == D_DISKLESS && device->ldev == NULL) + /* special case, drbd_md_read() during drbd_adm_attach(): no get_ldev */ + ; +diff -Nupr a/drbd/drbd_bitmap.c b/drbd/drbd_bitmap.c +--- a/drbd/drbd_bitmap.c 2022-07-07 18:24:13.671780513 +0800 ++++ b/drbd/drbd_bitmap.c 2022-07-08 06:49:05.232970673 +0800 +@@ -1123,12 +1123,13 @@ static void drbd_bm_endio(struct bio *bi + + static void bm_page_io_async(struct drbd_bm_aio_ctx *ctx, int page_nr) __must_hold(local) + { +- struct bio *bio = bio_alloc_bioset(GFP_NOIO, 1, &drbd_md_io_bio_set); + struct drbd_device *device = ctx->device; ++ unsigned int op = (ctx->flags & BM_AIO_READ) ? REQ_OP_READ : REQ_OP_WRITE; ++ struct bio *bio = bio_alloc_bioset(device->ldev->md_bdev, 1, op, ++ GFP_NOIO, &drbd_md_io_bio_set); + struct drbd_bitmap *b = device->bitmap; + struct page *page; + unsigned int len; +- unsigned int op = (ctx->flags & BM_AIO_READ) ? REQ_OP_READ : REQ_OP_WRITE; + + sector_t on_disk_sector = + device->ldev->md.md_offset + device->ldev->md.bm_offset; +@@ -1153,14 +1154,12 @@ static void bm_page_io_async(struct drbd + bm_store_page_idx(page, page_nr); + } else + page = b->bm_pages[page_nr]; +- bio_set_dev(bio, device->ldev->md_bdev); + bio->bi_iter.bi_sector = on_disk_sector; + /* bio_add_page of a single page to an empty bio will always succeed, + * according to api. Do we want to assert that? */ + bio_add_page(bio, page, len, 0); + bio->bi_private = ctx; + bio->bi_end_io = drbd_bm_endio; +- bio->bi_opf = op; + + if (drbd_insert_fault(device, (op == REQ_OP_WRITE) ? DRBD_FAULT_MD_WR : DRBD_FAULT_MD_RD)) { + bio->bi_status = BLK_STS_IOERR; diff --git a/bsc-1201335_05-bio_alloc.patch b/bsc-1201335_05-bio_alloc.patch new file mode 100644 index 0000000..7e6b4dd --- /dev/null +++ b/bsc-1201335_05-bio_alloc.patch @@ -0,0 +1,70 @@ +/* this patch is related with following upstream kernel commit */ + +commit 07888c665b405b1cd3577ddebfeb74f4717a84c4 +Author: Christoph Hellwig +Date: Mon Jan 24 10:11:05 2022 +0100 + + block: pass a block_device and opf to bio_alloc + + Pass the block_device and operation that we plan to use this bio for to + bio_alloc to optimize the assignment. NULL/0 can be passed, both for the + passthrough case on a raw request_queue and to temporarily avoid + refactoring some nasty code. + + Also move the gfp_mask argument after the nr_vecs argument for a much + more logical calling convention matching what most of the kernel does. + + Signed-off-by: Christoph Hellwig + Reviewed-by: Chaitanya Kulkarni + Link: https://lore.kernel.org/r/20220124091107.642561-18-hch@lst.de + Signed-off-by: Jens Axboe +--- + +diff -Nupr a/drbd/drbd_receiver.c b/drbd/drbd_receiver.c +--- a/drbd/drbd_receiver.c 2022-07-08 06:55:17.451589834 +0800 ++++ b/drbd/drbd_receiver.c 2022-07-08 06:59:24.486571488 +0800 +@@ -1263,7 +1263,8 @@ static void one_flush_endio(struct bio * + + static void submit_one_flush(struct drbd_device *device, struct issue_flush_context *ctx) + { +- struct bio *bio = bio_alloc(GFP_NOIO, 0); ++ struct bio *bio = bio_alloc(device->ldev->backing_bdev, 0, ++ REQ_OP_FLUSH | REQ_PREFLUSH, GFP_NOIO); + struct one_flush_context *octx = kmalloc(sizeof(*octx), GFP_NOIO); + if (!bio || !octx) { + drbd_warn(device, "Could not allocate a bio, CANNOT ISSUE FLUSH\n"); +@@ -1283,14 +1284,12 @@ static void submit_one_flush(struct drbd + + octx->device = device; + octx->ctx = ctx; +- bio_set_dev(bio, device->ldev->backing_bdev); + bio->bi_private = octx; + bio->bi_end_io = one_flush_endio; + + device->flush_jif = jiffies; + set_bit(FLUSH_PENDING, &device->flags); + atomic_inc(&ctx->pending); +- bio->bi_opf = REQ_OP_FLUSH | REQ_PREFLUSH; + submit_bio(bio); + } + +@@ -1832,17 +1831,14 @@ next_bio: + goto fail; + } + +- bio = bio_alloc(GFP_NOIO, nr_pages); ++ bio = bio_alloc(device->ldev->backing_bdev, nr_pages, peer_req->opf, ++ GFP_NOIO); + if (!bio) { + drbd_err(device, "submit_ee: Allocation of a bio failed (nr_pages=%u)\n", nr_pages); + goto fail; + } + /* > peer_req->i.sector, unless this is the first bio */ + bio->bi_iter.bi_sector = sector; +- bio_set_dev(bio, device->ldev->backing_bdev); +- /* we special case some flags in the multi-bio case, see below +- * (REQ_PREFLUSH, or BIO_RW_BARRIER in older kernels) */ +- bio->bi_opf = peer_req->opf; + bio->bi_private = peer_req; + bio->bi_end_io = drbd_peer_request_endio; + diff --git a/bsc-1201335_06-bdi.patch b/bsc-1201335_06-bdi.patch new file mode 100644 index 0000000..9ee76a0 --- /dev/null +++ b/bsc-1201335_06-bdi.patch @@ -0,0 +1,117 @@ +/* this patch is related with following 3 upstream kernel commits */ + +commit 8fd6533ef3f7729e4aa29ead83844c042688615a +Author: Haowen Bai +Date: Wed Apr 6 21:07:15 2022 +0200 + + drbd: Return true/false (not 1/0) from bool functions + + Return boolean values ("true" or "false") instead of 1 or 0 from bool + functions. This fixes the following warnings from coccicheck: + + ./drivers/block/drbd/drbd_req.c:912:9-10: WARNING: return of 0/1 in + function 'remote_due_to_read_balancing' with return type bool + + Signed-off-by: Haowen Bai + Reviewed-by: Christoph Böhmwalder + Link: https://lore.kernel.org/r/20220406190715.1938174-8-christoph.boehmwalder@linbit.com + Signed-off-by: Jens Axboe + +--- +commit b9b1335e640308acc1b8f26c739b804c80a6c147 +Author: NeilBrown +Date: Tue Mar 22 14:39:10 2022 -0700 + + remove bdi_congested() and wb_congested() and related functions + + These functions are no longer useful as no BDIs report congestions any + more. + + Removing the test on bdi_write_contested() in current_may_throttle() + could cause a small change in behaviour, but only when PF_LOCAL_THROTTLE + is set. + + So replace the calls by 'false' and simplify the code - and remove the + functions. + + [akpm@linux-foundation.org: fix build] + + Link: https://lkml.kernel.org/r/164549983742.9187.2570198746005819592.stgit@noble.brown + Signed-off-by: NeilBrown + Acked-by: Ryusuke Konishi [nilfs] + Cc: Anna Schumaker + Cc: Chao Yu + Cc: Darrick J. Wong + Cc: Ilya Dryomov + Cc: Jaegeuk Kim + Cc: Jan Kara + Cc: Jeff Layton + Cc: Jens Axboe + Cc: Lars Ellenberg + Cc: Miklos Szeredi + Cc: Paolo Valente + Cc: Philipp Reisner + Cc: Trond Myklebust + Cc: Wu Fengguang + Signed-off-by: Andrew Morton + Signed-off-by: Linus Torvalds + +--- +commit edb0872f44ec9976ea6d052cb4b93cd2d23ac2ba +Author: Christoph Hellwig +Date: Mon Aug 9 16:17:43 2021 +0200 + + block: move the bdi from the request_queue to the gendisk + + The backing device information only makes sense for file system I/O, + and thus belongs into the gendisk and not the lower level request_queue + structure. Move it there. + + Signed-off-by: Christoph Hellwig + Reviewed-by: Johannes Thumshirn + Link: https://lore.kernel.org/r/20210809141744.1203023-5-hch@lst.de + Signed-off-by: Jens Axboe + +--- + +diff -Nupr a/drbd/drbd_req.c b/drbd/drbd_req.c +--- a/drbd/drbd_req.c 2022-07-08 18:08:35.075249173 +0800 ++++ b/drbd/drbd_req.c 2022-07-08 07:50:00.750419154 +0800 +@@ -1148,13 +1148,11 @@ static bool remote_due_to_read_balancing + struct drbd_peer_device *peer_device, sector_t sector, + enum drbd_read_balancing rbm) + { +- struct backing_dev_info *bdi; + int stripe_shift; + + switch (rbm) { + case RB_CONGESTED_REMOTE: +- bdi = device->ldev->backing_bdev->bd_disk->queue->backing_dev_info; +- return bdi_read_congested(bdi); ++ return false; + case RB_LEAST_PENDING: + return atomic_read(&device->local_cnt) > + atomic_read(&peer_device->ap_pending_cnt) + atomic_read(&peer_device->rs_pending_cnt); +diff -Nupr a/drbd/drbd_nl.c b/drbd/drbd_nl.c +--- a/drbd/drbd_nl.c 2022-07-08 08:50:52.751580529 +0800 ++++ b/drbd/drbd_nl.c 2022-07-08 08:51:20.971464720 +0800 +@@ -5593,7 +5593,6 @@ static void device_to_statistics(struct + if (get_ldev(device)) { + struct drbd_md *md = &device->ldev->md; + u64 *history_uuids = (u64 *)s->history_uuids; +- struct request_queue *q; + int n; + + spin_lock_irq(&md->uuid_lock); +@@ -5605,11 +5604,6 @@ static void device_to_statistics(struct + spin_unlock_irq(&md->uuid_lock); + + s->dev_disk_flags = md->flags; +- q = bdev_get_queue(device->ldev->backing_bdev); +- s->dev_lower_blocked = +- bdi_congested(q->backing_dev_info, +- (1 << WB_async_congested) | +- (1 << WB_sync_congested)); + put_ldev(device); + } + s->dev_size = get_capacity(device->vdisk); diff --git a/bsc-1201335_07-write-same.patch b/bsc-1201335_07-write-same.patch new file mode 100644 index 0000000..1b671f5 --- /dev/null +++ b/bsc-1201335_07-write-same.patch @@ -0,0 +1,28 @@ +/* this patch is related with following upstream kernel commit */ + +commit a34592ff6b78e84e11b19183b60cd240737f76f9 +Author: Christoph Hellwig +Date: Wed Feb 9 09:28:23 2022 +0100 + + scsi: drbd: Remove WRITE_SAME support + + REQ_OP_WRITE_SAME was only ever submitted by the legacy Linux zeroing code, + which has switched to use REQ_OP_WRITE_ZEROES long ago. + + Link: https://lore.kernel.org/r/20220209082828.2629273-3-hch@lst.de + Signed-off-by: Christoph Hellwig + Signed-off-by: Martin K. Petersen +--- + +diff -Nupr a/drbd/drbd_receiver.c b/drbd/drbd_receiver.c +--- a/drbd/drbd_receiver.c 2022-07-08 07:14:26.331017361 +0800 ++++ b/drbd/drbd_receiver.c 2022-07-08 07:14:57.750893198 +0800 +@@ -2737,8 +2737,6 @@ static unsigned long wire_flags_to_bio_o + return REQ_OP_WRITE_ZEROES; + if (dpf & DP_DISCARD) + return REQ_OP_DISCARD; +- if (dpf & DP_WSAME) +- return REQ_OP_WRITE_SAME; + else + return REQ_OP_WRITE; + } diff --git a/bsc-1201335_08-bio_clone_fast.patch b/bsc-1201335_08-bio_clone_fast.patch new file mode 100644 index 0000000..f50d732 --- /dev/null +++ b/bsc-1201335_08-bio_clone_fast.patch @@ -0,0 +1,30 @@ +/* this patch is related with following upstream kernel commit */ + +commit abfc426d1b2fb2176df59851a64223b58ddae7e7 +Author: Christoph Hellwig +Date: Wed Feb 2 17:01:09 2022 +0100 + + block: pass a block_device to bio_clone_fast + + Pass a block_device to bio_clone_fast and __bio_clone_fast and give + the functions more suitable names. + + Signed-off-by: Christoph Hellwig + Reviewed-by: Mike Snitzer + Link: https://lore.kernel.org/r/20220202160109.108149-14-hch@lst.de + Signed-off-by: Jens Axboe +--- + +diff -Nupr a/drbd/drbd_req.c b/drbd/drbd_req.c +--- a/drbd/drbd_req.c 2022-07-08 08:00:58.007783979 +0800 ++++ b/drbd/drbd_req.c 2022-07-08 08:09:29.157733345 +0800 +@@ -1543,7 +1543,8 @@ drbd_request_prepare(struct drbd_device + req->start_jif = bio_start_io_acct(req->master_bio); + + if (get_ldev(device)) { +- req->private_bio = bio_clone_fast(bio, GFP_NOIO, &drbd_io_bio_set); ++ req->private_bio = bio_alloc_clone(device->ldev->backing_bdev, bio, ++ GFP_NOIO, &drbd_io_bio_set); + req->private_bio->bi_private = req; + req->private_bio->bi_end_io = drbd_request_endio; + } diff --git a/drbd.changes b/drbd.changes index 11c8fe4..dd7976c 100644 --- a/drbd.changes +++ b/drbd.changes @@ -1,3 +1,37 @@ +------------------------------------------------------------------- +Fri Jul 08 12:47:00 UTC 2022 - Heming Zhao + +- drbd: build error against kernel v5.18 (bsc#1201335) + - remove patch: move_bdi_from_request_queue_to_gendisk + - change exist patches name from bsc#1192929: + old name: + make_block_holder_optional.patch + move_kvmalloc_related_to_slab.patch + polling_to_bio_base.patch + pass_gend_to_blk_queue_update_readahead.patch + dax_support.patch + add_disk_error_handle.patch + have_void_drbd_submit_bio.patch + remove_bdgrab.patch + new name: + bsc-1192929_01-make_block_holder_optional.patch + bsc-1192929_02-move_kvmalloc_related_to_slab.patch + bsc-1192929_03-polling_to_bio_base.patch + bsc-1192929_04-pass_gend_to_blk_queue_update_readahead.patch + bsc-1192929_06-dax_support.patch + bsc-1192929_07-add_disk_error_handle.patch + bsc-1192929_08-have_void_drbd_submit_bio.patch + bsc-1192929_09-remove_bdgrab.patch + - add patch: + + bsc-1201335_01-compat-test-and-cocci-patch-for-bdi-in-gendisk.patch + + bsc-1201335_02-0001-compat-only-apply-bdi-pointer-patch-if-bdi-is-in-req.patch + + bsc-1201335_03-genhd.patch + + bsc-1201335_04-bio_alloc_bioset.patch + + bsc-1201335_05-bio_alloc.patch + + bsc-1201335_06-bdi.patch + + bsc-1201335_07-write-same.patch + + bsc-1201335_08-bio_clone_fast.patch + ------------------------------------------------------------------- Mon Nov 22 04:38:30 UTC 2021 - nick wang diff --git a/drbd.spec b/drbd.spec index bd8c1b0..dcc45c4 100644 --- a/drbd.spec +++ b/drbd.spec @@ -35,15 +35,23 @@ Source1: preamble Source2: Module.supported Source3: drbd_git_revision Patch1: fix-resync-finished-with-syncs-have-bits-set.patch -Patch2: make_block_holder_optional.patch -Patch3: move_kvmalloc_related_to_slab.patch -Patch4: polling_to_bio_base.patch -Patch5: pass_gend_to_blk_queue_update_readahead.patch -Patch6: move_bdi_from_request_queue_to_gendisk.patch -Patch7: dax_support.patch -Patch8: add_disk_error_handle.patch -Patch9: have_void_drbd_submit_bio.patch -Patch10: remove_bdgrab.patch +Patch2: bsc-1192929_01-make_block_holder_optional.patch +Patch3: bsc-1192929_02-move_kvmalloc_related_to_slab.patch +Patch4: bsc-1192929_03-polling_to_bio_base.patch +Patch5: bsc-1192929_04-pass_gend_to_blk_queue_update_readahead.patch +#Patch6: bsc-1192929_05-move_bdi_from_request_queue_to_gendisk +Patch7: bsc-1192929_06-dax_support.patch +Patch8: bsc-1192929_07-add_disk_error_handle.patch +Patch9: bsc-1192929_08-have_void_drbd_submit_bio.patch +Patch10: bsc-1192929_09-remove_bdgrab.patch +Patch11: bsc-1201335_01-compat-test-and-cocci-patch-for-bdi-in-gendisk.patch +Patch12: bsc-1201335_02-compat-only-apply-bdi-pointer-patch-if-bdi-is-in-req.patch +Patch13: bsc-1201335_03-genhd.patch +Patch14: bsc-1201335_04-bio_alloc_bioset.patch +Patch15: bsc-1201335_05-bio_alloc.patch +Patch16: bsc-1201335_06-bdi.patch +Patch17: bsc-1201335_07-write-same.patch +Patch18: bsc-1201335_08-bio_clone_fast.patch Patch99: suse-coccinelle.patch #https://github.com/openSUSE/rpmlint-checks/blob/master/KMPPolicyCheck.py BuildRequires: coccinelle >= 1.0.8 @@ -82,11 +90,19 @@ installed kernel. %patch3 -p1 %patch4 -p1 %patch5 -p1 -%patch6 -p1 +#%patch6 -p1 %patch7 -p1 %patch8 -p1 %patch9 -p1 %patch10 -p1 +%patch11 -p1 +%patch12 -p1 +%patch13 -p1 +%patch14 -p1 +%patch15 -p1 +%patch16 -p1 +%patch17 -p1 +%patch18 -p1 %patch99 -p1 mkdir source diff --git a/move_bdi_from_request_queue_to_gendisk.patch b/move_bdi_from_request_queue_to_gendisk.patch deleted file mode 100644 index 74cfbcf..0000000 --- a/move_bdi_from_request_queue_to_gendisk.patch +++ /dev/null @@ -1,84 +0,0 @@ -diff -Naur drbd-9.0.30~1+git.8e9c0812.orig/drbd/drbd-kernel-compat/gen_patch_names.c drbd-9.0.30~1+git.8e9c0812/drbd/drbd-kernel-compat/gen_patch_names.c ---- drbd-9.0.30~1+git.8e9c0812.orig/drbd/drbd-kernel-compat/gen_patch_names.c 2021-11-22 14:00:22.158226957 +0800 -+++ drbd-9.0.30~1+git.8e9c0812/drbd/drbd-kernel-compat/gen_patch_names.c 2021-11-22 14:10:47.141520981 +0800 -@@ -396,8 +396,10 @@ - COMPAT_HAVE_BLK_QUEUE_UPDATE_READAHEAD, "present"); - #endif - -+#ifndef COMPAT_HAVE_GENDISK_BACKING_DEV_INFO - patch(1, "backing_dev_info", true, false, - COMPAT_HAVE_POINTER_BACKING_DEV_INFO, "is_pointer"); -+#endif - - patch(1, "sendpage_ok", true, false, - COMPAT_HAVE_SENDPAGE_OK, "present"); -diff -Naur drbd-9.0.30~1+git.8e9c0812.orig/drbd/drbd-kernel-compat/tests/have_gendisk_backing_dev_info.c drbd-9.0.30~1+git.8e9c0812/drbd/drbd-kernel-compat/tests/have_gendisk_backing_dev_info.c ---- drbd-9.0.30~1+git.8e9c0812.orig/drbd/drbd-kernel-compat/tests/have_gendisk_backing_dev_info.c 1970-01-01 08:00:00.000000000 +0800 -+++ drbd-9.0.30~1+git.8e9c0812/drbd/drbd-kernel-compat/tests/have_gendisk_backing_dev_info.c 2021-11-22 14:08:58.564950244 +0800 -@@ -0,0 +1,11 @@ -+/* { "version": "v5.15-rc1~161", "commit": "edb0872f44ec9976ea6d052cb4b93cd2d23ac2ba", "comment": "block: move the bdi from the request_queue to the gendisk", "author": "Christoph Hellwig ", "date": "Mon Aug 9 16:17:43 2021 +0200" } */ -+ -+ -+#include -+#include -+ -+void dummy(struct gendisk *gd) -+{ -+ struct backing_dev_info *b; -+ b = gd->bdi; -+} -diff -Naur drbd-9.0.30~1+git.8e9c0812.orig/drbd/drbd_nl.c drbd-9.0.30~1+git.8e9c0812/drbd/drbd_nl.c ---- drbd-9.0.30~1+git.8e9c0812.orig/drbd/drbd_nl.c 2021-11-22 14:00:22.158226957 +0800 -+++ drbd-9.0.30~1+git.8e9c0812/drbd/drbd_nl.c 2021-11-22 14:40:51.131336874 +0800 -@@ -5594,7 +5594,9 @@ - if (get_ldev(device)) { - struct drbd_md *md = &device->ldev->md; - u64 *history_uuids = (u64 *)s->history_uuids; -+#ifndef COMPAT_HAVE_GENDISK_BACKING_DEV_INFO - struct request_queue *q; -+#endif - int n; - - spin_lock_irq(&md->uuid_lock); -@@ -5606,11 +5608,18 @@ - spin_unlock_irq(&md->uuid_lock); - - s->dev_disk_flags = md->flags; -+#ifndef COMPAT_HAVE_GENDISK_BACKING_DEV_INFO - q = bdev_get_queue(device->ldev->backing_bdev); - s->dev_lower_blocked = - bdi_congested(q->backing_dev_info, - (1 << WB_async_congested) | - (1 << WB_sync_congested)); -+#else -+ s->dev_lower_blocked = -+ bdi_congested(device->ldev->backing_bdev->bd_disk->bdi, -+ (1 << WB_async_congested) | -+ (1 << WB_sync_congested)); -+#endif - put_ldev(device); - } - s->dev_size = get_capacity(device->vdisk); -diff -Naur drbd-9.0.30~1+git.8e9c0812.orig/drbd/drbd_req.c drbd-9.0.30~1+git.8e9c0812/drbd/drbd_req.c ---- drbd-9.0.30~1+git.8e9c0812.orig/drbd/drbd_req.c 2021-11-22 14:00:22.158226957 +0800 -+++ drbd-9.0.30~1+git.8e9c0812/drbd/drbd_req.c 2021-11-22 14:15:43.103076717 +0800 -@@ -1148,13 +1148,19 @@ - struct drbd_peer_device *peer_device, sector_t sector, - enum drbd_read_balancing rbm) - { -+#ifndef COMPAT_HAVE_GENDISK_BACKING_DEV_INFO - struct backing_dev_info *bdi; -+#endif - int stripe_shift; - - switch (rbm) { - case RB_CONGESTED_REMOTE: -+#ifndef COMPAT_HAVE_GENDISK_BACKING_DEV_INFO - bdi = device->ldev->backing_bdev->bd_disk->queue->backing_dev_info; - return bdi_read_congested(bdi); -+#else -+ return bdi_read_congested(device->ldev->backing_bdev->bd_disk->bdi); -+#endif - case RB_LEAST_PENDING: - return atomic_read(&device->local_cnt) > - atomic_read(&peer_device->ap_pending_cnt) + atomic_read(&peer_device->rs_pending_cnt); From a1185e08654c60681c549e375a93d8aed0efd7bdb1bb5507d343782cbe0ebae2 Mon Sep 17 00:00:00 2001 From: heming zhao Date: Mon, 18 Jul 2022 08:07:39 +0000 Subject: [PATCH 2/2] Accepting request 989810 from home:hmzhao:branches:network:ha-clustering:Factory fix drbd.changes mistakes, which made before request 'declined' when pushing to opensuse:factory. OBS-URL: https://build.opensuse.org/request/show/989810 OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/drbd?expand=0&rev=138 --- drbd.changes | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drbd.changes b/drbd.changes index dd7976c..192c319 100644 --- a/drbd.changes +++ b/drbd.changes @@ -2,7 +2,8 @@ Fri Jul 08 12:47:00 UTC 2022 - Heming Zhao - drbd: build error against kernel v5.18 (bsc#1201335) - - remove patch: move_bdi_from_request_queue_to_gendisk + - remove patch: + + move_bdi_from_request_queue_to_gendisk.patch - change exist patches name from bsc#1192929: old name: make_block_holder_optional.patch @@ -24,7 +25,7 @@ Fri Jul 08 12:47:00 UTC 2022 - Heming Zhao bsc-1192929_09-remove_bdgrab.patch - add patch: + bsc-1201335_01-compat-test-and-cocci-patch-for-bdi-in-gendisk.patch - + bsc-1201335_02-0001-compat-only-apply-bdi-pointer-patch-if-bdi-is-in-req.patch + + bsc-1201335_02-compat-only-apply-bdi-pointer-patch-if-bdi-is-in-req.patch + bsc-1201335_03-genhd.patch + bsc-1201335_04-bio_alloc_bioset.patch + bsc-1201335_05-bio_alloc.patch