[bug report][libnvme/nvme-cli] "nvme smart-log" fails with liburing

Shinichiro Kawasaki shinichiro.kawasaki at wdc.com
Tue May 27 03:31:18 PDT 2025


Hi Daniel, I think I found a problem in libnvme as below. Is this a known issue?

When I ran blktests on Fedora 42, I noticed that the test case nvme/023 failed
with the message "ERROR: smart-log bdev-ns failed". This failure can be
recreated by the single command "# nvme smart-log /dev/nvme0n1". I investigated
conditions to recreate the failure and found these:

- The command fails with the namespace devices, while the command succeeds with
  the controller devices, e.g.,
    # nvme smart-log /dev/nvme0
    # nvme smart-log /dev/nvme0 --namespace-id=1

- I checked the man page of nvme smart-logs:

   "The <device> parameter is mandatory and may be either the NVMe character
    device (ex: /dev/nvme0), or a namespace block device (ex: /dev/nvme0n1)."

  Then, it looks that the nvme-cli does not do what it advertises.

- I bisected libnvme and found the trigger of the failure is the commit below
  in libnvme v1.13:

   8ddf4c73d379 ("ioctl: return status code when using liburing")

- When libnvme is built with liburing, the failure happens. When libnvme
  is built without liburing, the failure does not happen.

I took a look in the kernel code. The io_uring_setup ioctl for namespace
devices falls into blkdev_uring_cmd() in block layer. It does not reach to
nvme driver and just fails. So I guess the kernel does not support nvme
admin commands for namespace devices through io_uring. Assuming this guess is
correct, I think libnvme should use regular ioctl instead for io_uring for
namespace devices. What do you think?


More information about the Linux-nvme mailing list