Skip to content

src/Makefile: nvme-passthru-admin-uring not built when linux/ublk_cmd.h is absent #236

@gitPo1son

Description

@gitPo1son

Hello, @kawasaki Please help check this issue.

Summary

After make / make install, src/nvme-passthru-admin-uring is not built when linux/ublk_cmd.h is missing from userspace kernel headers, even if liburing is new enough (IORING_OP_URING_CMD).
Tests such as nvme/067 then fail with sudo: src/nvme-passthru-admin-uring: command not found. nvme-passthru-admin-uring does not include linux/ublk_cmd.h; only miniublk needs it.
The Makefile currently ties all C_URING_TARGETS to the same HAVE_LIBURING + HAVE_UBLK_HEADER gate (or equivalent), so the NVMe helper is skipped together with miniublk.

Environment

  • OS: RHEL 9.8
  • Running kernel: 5.14.0-687.el9.x86_64
  • kernel-headers: (kernel-headers-5.14.0-687.el9.x86_64)
  • liburing-devel: (liburing-devel-2.12-1.el9.x86_64)

Reproduce

[root@smicro-s110p-01 blktests]# make
make -C src all
make[1]: Entering directory '/root/blktests/src'
Skip miniublk metadata nvme-passthru-admin-uring build due to missing kernel header(v6.0+) or liburing(2.2+)
cc  -O2 -Wall -Wshadow  -DHAVE_LINUX_BLKZONED_H  -o dio-offsets dio-offsets.c
cc  -O2 -Wall -Wshadow  -DHAVE_LINUX_BLKZONED_H  -o loblksize loblksize.c
cc  -O2 -Wall -Wshadow  -DHAVE_LINUX_BLKZONED_H  -o loop_change_fd loop_change_fd.c
cc  -O2 -Wall -Wshadow  -DHAVE_LINUX_BLKZONED_H  -o loop_get_status_null loop_get_status_null.c
cc  -O2 -Wall -Wshadow  -DHAVE_LINUX_BLKZONED_H  -o mount_clear_sock mount_clear_sock.c
cc  -O2 -Wall -Wshadow  -DHAVE_LINUX_BLKZONED_H  -o nvme-passthrough-meta nvme-passthrough-meta.c
cc  -O2 -Wall -Wshadow  -DHAVE_LINUX_BLKZONED_H  -o ioctl-lbmd-query ioctl-lbmd-query.c
cc  -O2 -Wall -Wshadow  -DHAVE_LINUX_BLKZONED_H  -o nbdsetsize nbdsetsize.c
cc  -O2 -Wall -Wshadow  -DHAVE_LINUX_BLKZONED_H  -o openclose openclose.c
cc  -O2 -Wall -Wshadow  -DHAVE_LINUX_BLKZONED_H  -o sg/dxfer-from-dev sg/dxfer-from-dev.c
cc  -O2 -Wall -Wshadow  -DHAVE_LINUX_BLKZONED_H  -o sg/syzkaller1 sg/syzkaller1.c
cc  -O2 -Wall -Wshadow  -DHAVE_LINUX_BLKZONED_H  -o zbdioctl zbdioctl.c
g++  -O2 -std=c++11 -Wall -Wextra -Wshadow -Wno-sign-compare -Werror  -DHAVE_LINUX_BLKZONED_H  -o discontiguous-io discontiguous-io.cpp
make[1]: Leaving directory '/root/blktests/src'
[root@smicro-s110p-01 blktests]# 
[root@smicro-s110p-01 blktests]# 



[root@smicro-s110p-01 blktests]# make install
install -m755 -d /usr/local/blktests
install check /usr/local/blktests
cp -R tests common /usr/local/blktests
make -C src dest=/usr/local/blktests/src install
make[1]: Entering directory '/root/blktests/src'
Skip miniublk metadata nvme-passthru-admin-uring build due to missing kernel header(v6.0+) or liburing(2.2+)
install -m755 -d /usr/local/blktests/src
install dio-offsets loblksize loop_change_fd loop_get_status_null mount_clear_sock nvme-passthrough-meta ioctl-lbmd-query nbdsetsize openclose sg/dxfer-from-dev sg/syzkaller1 zbdioctl discontiguous-io /usr/local/blktests/src
make[1]: Leaving directory '/root/blktests/src'
[root@smicro-s110p-01 blktests]# 




[root@smicro-s110p-01 blktests]# ./check nvme/067
nvme/067 => nvme0n1 (exercise the nvme admin commands usage with io uring passthrough intnvme/067 => nvme0n1 (exercise the nvme admin commands usage with io uring passthrough interfaces) [failed]
    runtime    ...  0.011s
    --- tests/nvme/067.out      2026-03-26 23:03:04.458850044 -0400
    +++ /root/blktests/results/nvme0n1/nvme/067.out.bad 2026-03-26 23:07:24.620191138 -0400
    @@ -1,2 +1,4 @@
     Running nvme/067
    +sudo: src/nvme-passthru-admin-uring: command not found
    +src/nvme-passthru-admin-uring failed
     Test Complete

Expected

nvme-passthru-admin-uring should be built whenever liburing is sufficient; only
miniublk should require linux/ublk_cmd.h.

Proposed fix

When the full io_uring+ublk stack is not available, still build metadata and nvme-passthru-admin-uring if HAVE_LIBURING is 1, and only skip miniublk with an explicit message when linux/ublk_cmd.h is missing.

Patch

diff --git a/src/Makefile b/src/Makefile
index bd94636..f825024 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -35,8 +35,14 @@ CXX_TARGETS := \
 ifeq ($(HAVE_LIBURING)$(HAVE_UBLK_HEADER), 11)
 TARGETS := $(C_TARGETS) $(CXX_TARGETS) $(C_URING_TARGETS)
 else
-$(info Skip $(C_URING_TARGETS) build due to missing kernel header(v6.0+) or liburing(2.2+))
 TARGETS := $(C_TARGETS) $(CXX_TARGETS)
+ifeq ($(HAVE_LIBURING),1)
+# miniublk needs linux/ublk_cmd.h; these two only need liburing
+TARGETS += metadata nvme-passthru-admin-uring
+$(info Skip miniublk build due to missing linux/ublk_cmd.h (kernel headers v6.0+))
+else
+$(info Skip $(C_URING_TARGETS) build due to missing kernel header(v6.0+) or liburing(2.2+))
+endif
 endif
 
 CONFIG_DEFS := $(call HAVE_C_HEADER,linux/blkzoned.h,-DHAVE_LINUX_BLKZONED_H)

Test result

[root@smicro-s110p-01 blktests]# make
make -C src all
make[1]: Entering directory '/root/blktests/src'
Skip miniublk build due to missing linux/ublk_cmd.h (kernel headers v6.0+)
cc  -O2 -Wall -Wshadow  -DHAVE_LINUX_BLKZONED_H  -o dio-offsets dio-offsets.c
cc  -O2 -Wall -Wshadow  -DHAVE_LINUX_BLKZONED_H  -o loblksize loblksize.c
cc  -O2 -Wall -Wshadow  -DHAVE_LINUX_BLKZONED_H  -o loop_change_fd loop_change_fd.c
cc  -O2 -Wall -Wshadow  -DHAVE_LINUX_BLKZONED_H  -o loop_get_status_null loop_get_status_null.c
cc  -O2 -Wall -Wshadow  -DHAVE_LINUX_BLKZONED_H  -o mount_clear_sock mount_clear_sock.c
cc  -O2 -Wall -Wshadow  -DHAVE_LINUX_BLKZONED_H  -o nvme-passthrough-meta nvme-passthrough-meta.c
cc  -O2 -Wall -Wshadow  -DHAVE_LINUX_BLKZONED_H  -o ioctl-lbmd-query ioctl-lbmd-query.c
cc  -O2 -Wall -Wshadow  -DHAVE_LINUX_BLKZONED_H  -o nbdsetsize nbdsetsize.c
cc  -O2 -Wall -Wshadow  -DHAVE_LINUX_BLKZONED_H  -o openclose openclose.c
cc  -O2 -Wall -Wshadow  -DHAVE_LINUX_BLKZONED_H  -o sg/dxfer-from-dev sg/dxfer-from-dev.c
cc  -O2 -Wall -Wshadow  -DHAVE_LINUX_BLKZONED_H  -o sg/syzkaller1 sg/syzkaller1.c
cc  -O2 -Wall -Wshadow  -DHAVE_LINUX_BLKZONED_H  -o zbdioctl zbdioctl.c
g++  -O2 -std=c++11 -Wall -Wextra -Wshadow -Wno-sign-compare -Werror  -DHAVE_LINUX_BLKZONED_H  -o discontiguous-io discontiguous-io.cpp
cc -O2 -Wall -Wshadow  -DHAVE_LINUX_BLKZONED_H  -D_GNU_SOURCE -o metadata metadata.c -lpthread -luring
cc -O2 -Wall -Wshadow  -DHAVE_LINUX_BLKZONED_H  -D_GNU_SOURCE -o nvme-passthru-admin-uring nvme-passthru-admin-uring.c -lpthread -luring
make[1]: Leaving directory '/root/blktests/src'
[root@smicro-s110p-01 blktests]# 



[root@smicro-s110p-01 blktests]# 
[root@smicro-s110p-01 blktests]# make install
install -m755 -d /usr/local/blktests
install check /usr/local/blktests
cp -R tests common /usr/local/blktests
make -C src dest=/usr/local/blktests/src install
make[1]: Entering directory '/root/blktests/src'
Skip miniublk build due to missing linux/ublk_cmd.h (kernel headers v6.0+)
install -m755 -d /usr/local/blktests/src
install dio-offsets loblksize loop_change_fd loop_get_status_null mount_clear_sock nvme-passthrough-meta ioctl-lbmd-query nbdsetsize openclose sg/dxfer-from-dev sg/syzkaller1 zbdioctl discontiguous-io metadata nvme-passthru-admin-uring /usr/local/blktests/src
make[1]: Leaving directory '/root/blktests/src'
[root@smicro-s110p-01 blktests]# 



[root@smicro-s110p-01 blktests]# ls src/nvme-passthru-admin-uring
src/nvme-passthru-admin-uring
[root@smicro-s110p-01 blktests]# ./check nvme/067
nvme/067 => nvme0n1 (exercise the nvme admin commands usage with io uring passthrough interfaces) [passed]
    runtime  0.011s  ...  0.011s
nvme/067 => nvme4n1 (exercise the nvme admin commands usage with io uring passthrough interfaces) [passed]
    runtime  0.011s  ...  0.011s
[root@smicro-s110p-01 blktests]# 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions