blksnap icon indicating copy to clipboard operation
blksnap copied to clipboard

Adapt for kernel 6.14

Open mike2307 opened this issue 9 months ago • 3 comments

Description

The flag BLK_MQ_F_SHOULD_MERGE was removed in kernel 6.14 (see https://lore.kernel.org/linux-block/[email protected]/T/). This shall be adapted in file snapimage.c

Usage tips

  • Please use the 👍 reaction to show that you are interested into this.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this.
  • Subscribe to receive notifications on status change and new comments, you can do also without add comment.

mike2307 avatar Mar 20 '25 16:03 mike2307

Yes. This is a change in the 6.14 kernel, which still has RC status. Of course, we plan to support it in one of the future releases.

diff --git a/module/Makefile-config b/module/Makefile-config
index d3e9a9a..8147f7d 100644
--- a/module/Makefile-config
+++ b/module/Makefile-config
@@ -86,4 +86,6 @@ EXTRA_CFLAGS += $(shell test -f $(srctree)/include/linux/blkdev.h &&		\
 EXTRA_CFLAGS += $(shell test -f $(srctree)/include/linux/blkdev.h &&		\
 	grep -qw "void blk_queue_max_hw_sectors" $(srctree)/include/linux/blkdev.h &&	\
 		echo -D HAVE_BLK_QUEUE_MAX_HW_SECTORS)
-
+EXTRA_CFLAGS += $(shell test -f $(srctree)/include/linux/blk-mq.h &&		\
+	grep -qw "BLK_MQ_F_SHOULD_MERGE" $(srctree)/include/linux/blk-mq.h &&	\
+		echo -D HAVE_BLK_MQ_F_SHOULD_MERGE)
diff --git a/module/snapimage.c b/module/snapimage.c
index 0635636..bb0ca05 100644
--- a/module/snapimage.c
+++ b/module/snapimage.c
@@ -176,7 +176,11 @@ static inline int snapimage_alloc_tag_set(struct snapimage *snapimage)
 	set->nr_maps = 1;
 	set->queue_depth = 128;
 	set->numa_node = NUMA_NO_NODE;
+#ifdef HAVE_BLK_MQ_F_SHOULD_MERGE
 	set->flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_STACKING;
+#else
+	set->flags = BLK_MQ_F_STACKING;
+#endif
 
 	set->cmd_size = sizeof(struct snapimage_cmd);
 	set->driver_data = snapimage;

SergeiShtepa avatar Mar 21 '25 10:03 SergeiShtepa

Got this at 6.14 while modprobe veeamblksnap:

bdevfilter: Failed to register ftrace handler (-16)

Sfinx avatar Mar 24 '25 18:03 Sfinx

On openSUSE Tumbleweed I experienced this error:

user@localhost:~> sudo dkms autoinstall
Sign command: /lib/modules/6.14.5-1-default/build/scripts/sign-file
Signing key: /var/lib/dkms/mok.key
Public certificate (MOK): /var/lib/dkms/mok.pub

Autoinstall of module blksnap/6.3.1.1016 for kernel 6.14.5-1-default (x86_64)
Cleaning build area... done.
Building module(s)...(bad exit status: 2)
Failed command:
make -j32 KERNELRELEASE=6.14.5-1-default -j32 -C /lib/modules/6.14.5-1-default/build M=/var/lib/dkms/blksnap/6.3.1.1016/build modules

Error! Bad return status for module build on kernel: 6.14.5-1-default (x86_64)
Consult /var/lib/dkms/blksnap/6.3.1.1016/build/make.log for more information.

Autoinstall on 6.14.5-1-default failed for module(s) blksnap(10).

Error! One or more modules failed to install during autoinstall.
Refer to previous errors for more information.

Log file:

 DKMS (dkms-3.1.6) make.log for blksnap/6.3.1.1016 for kernel 6.14.5-1-default (x86_64)
 Tue May 13 12:09:10 PM EDT 2025
 
 Cleaning build area
 # command: make -C /lib/modules/6.14.5-1-default/build M=/var/lib/dkms/blksnap/6.3.1.1016/build clean
 make: Entering directory '/usr/src/linux-6.14.5-1-obj/x86_64/default'
 make[1]: Entering directory '/var/lib/dkms/blksnap/6.3.1.1016/build'
 make[1]: Leaving directory '/var/lib/dkms/blksnap/6.3.1.1016/build'
 make: Leaving directory '/usr/src/linux-6.14.5-1-obj/x86_64/default'
 
 # exit code: 0
 # elapsed time: 00:00:00
 ----------------------------------------------------------------
 
 Building module(s)
 # command: make -j32 KERNELRELEASE=6.14.5-1-default -j32 -C /lib/modules/6.14.5-1-default/build M=/var/lib/dkms/blksnap/6.3.1.1016/build modules
 make: Entering directory '/usr/src/linux-6.14.5-1-obj/x86_64/default'
 make[1]: Entering directory '/var/lib/dkms/blksnap/6.3.1.1016/build'
   CC [M]  bdevfilter.o
   CC [M]  log.o
   CC [M]  log_histogram.o
   CC [M]  big_buffer.o
   CC [M]  cbt_map.o
   CC [M]  chunk.o
   CC [M]  ctrl.o
   CC [M]  diff_io.o
   CC [M]  diff_area.o
   CC [M]  diff_buffer.o
   CC [M]  diff_storage.o
   CC [M]  event_queue.o
   CC [M]  main.o
   CC [M]  snapimage.o
   CC [M]  snapshot.o
   CC [M]  sysfs.o
   CC [M]  tracker.o
   CC [M]  memory_checker.o
 main.c:23:9: note: ‘#pragma message: Standalone bdevfilter’
    23 | #pragma message("Standalone bdevfilter")
       |         ^~~~~~~
 main.c:29:9: note: ‘#pragma message: The void submit_bio_noacct(struct bio *) function was found.’
    29 | #pragma message("The void submit_bio_noacct(struct bio *) function was found.")
       |         ^~~~~~~
 main.c:35:9: note: ‘#pragma message: The struct bio have pointer to struct block_device.’
    35 | #pragma message("The struct bio have pointer to struct block_device.")
       |         ^~~~~~~
 main.c:41:9: note: ‘#pragma message: The bdev_nr_sectors() function was found.’
    41 | #pragma message("The bdev_nr_sectors() function was found.")
       |         ^~~~~~~
 main.c:44:9: note: ‘#pragma message: The blk_mq_alloc_disk() function was found.’
    44 | #pragma message("The blk_mq_alloc_disk() function was found.")
       |         ^~~~~~~
 main.c:50:9: note: ‘#pragma message: The function add_disk() has a return code.’
    50 | #pragma message("The function add_disk() has a return code.")
       |         ^~~~~~~
 main.c:56:9: note: ‘#pragma message: The function bio_alloc_bioset() has a parameter bdev.’
    56 | #pragma message("The function bio_alloc_bioset() has a parameter bdev.")
       |         ^~~~~~~
 main.c:62:9: note: ‘#pragma message: The struct blk_holder_ops was found.’
    62 | #pragma message("The struct blk_holder_ops was found.")
       |         ^~~~~~~
 main.c:68:9: note: ‘#pragma message: The function bdev_file_open_by_dev() was found.’
    68 | #pragma message("The function bdev_file_open_by_dev() was found.")
       |         ^~~~~~~
 main.c:71:9: note: ‘#pragma message: The function bdev_freeze() was found.’
    71 | #pragma message("The function bdev_freeze() was found.")
       |         ^~~~~~~
 snapimage.c: In function ‘snapimage_alloc_tag_set’:
 snapimage.c:179:22: error: ‘BLK_MQ_F_SHOULD_MERGE’ undeclared (first use in this function)
   179 |         set->flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_STACKING;
       |                      ^~~~~~~~~~~~~~~~~~~~~
 snapimage.c:179:22: note: each undeclared identifier is reported only once for each function it appears in
 make[3]: *** [/usr/src/linux-6.14.5-1/scripts/Makefile.build:208: snapimage.o] Error 1
 make[3]: *** Waiting for unfinished jobs....
 make[2]: *** [/usr/src/linux-6.14.5-1/Makefile:2020: .] Error 2
 make[1]: *** [/usr/src/linux-6.14.5-1/Makefile:251: __sub-make] Error 2
 make[1]: Leaving directory '/var/lib/dkms/blksnap/6.3.1.1016/build'
 make: *** [../../../linux-6.14.5-1/Makefile:251: __sub-make] Error 2
 make: Leaving directory '/usr/src/linux-6.14.5-1-obj/x86_64/default'
 
 # exit code: 2
 # elapsed time: 00:00:01
 ----------------------------------------------------------------
 

I was able to work around this by doing the following:

1. Locate and edit the source

sudo find /usr/src -name "snapimage.c" | grep blksnap
sudo nano /usr/src/blksnap-6.3.1.1016/snapimage.c

Change line 179:

set->flags = BLK_MQ_F_SHOULD_MERGE | BLK_MQ_F_STACKING;

to:

set->flags = BLK_MQ_F_STACKING;

2. Replace existing module

sudo dkms remove blksnap/6.3.1.1016 --all
sudo dkms add blksnap/6.3.1.1016

3. Build and install the module

sudo dkms build blksnap/6.3.1.1016
sudo dkms install blksnap/6.3.1.1016

wskel avatar May 13 '25 16:05 wskel

See: release 6.3.2.1207 Close.

SergeiShtepa avatar Jun 19 '25 12:06 SergeiShtepa