Skip to content

Conversation

@yizhanglinux
Copy link
Contributor

No description provided.

After the fix, we will exit earlier and get more info when we have
bdev-ns for smart-log command:
[1]
$ nvme smart-log /dev/nvme0n1
smart log: No such device or address
[2]
$ ./nvme smart-log /dev/nvme0n1
Only character device is allowed

Signed-off-by: Yi Zhang <yi.zhang@redhat.com>
if (err)
return err;

if (is_blkdev(dev)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks wrong. We should be able to get the smart log page data from a NVMe block device itself, right?

Copy link
Collaborator

@igaw igaw May 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far I understand the specs, it says SMART is only for the controller not a namespace.

5.1.12.1.3 SMART / Health Information (Log Page Identifier 02h)

This log page is used to provide SMART and general health information. The information provided is over
the life of the controller and is retained across power cycles unless otherwise specified. To request the
controller log page, the namespace identifier specified is FFFFFFFFh or 0h

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. But I think it would be harsh if we restrict this command to char devices alone and not block devices as well, not to speak of the confusion this would generate in the field. And I believe there are multiple other areas in the code as well where the same issue exists. So we may have to be careful before enforcing such a check here.

Copy link
Collaborator

@igaw igaw May 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is a result of a regression observed in blktests.

https://lore.kernel.org/linux-nvme/a25kumc6oyvzmr42jgowkf4yztmmiypxrvnygetwv6qvc2ol6b@tzhqqggcme3q/

If I read the spec right, then the block device is just wrong and it just worked because the devices are not checking the namespace identifier. If my understanding is correct I have no problem in breaking existing users. Or at least introduce a warning for nvme-cli 2.x and kill it for nvme-cli 3.x

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, I stopped reading too early. The spec says:

The controller may also
support requesting the log page on a per namespace basis, as indicated by the SMART Support bit of the
LPA field in the Identify Controller data structure in Figure 312.

@igaw
Copy link
Collaborator

igaw commented May 28, 2025

So indeed this is not correct as @martin-gpy pointed out. Let's close this one and fix the blktests nvme/023 bug correctly.

@igaw
Copy link
Collaborator

igaw commented May 28, 2025

So the correct fix is only to use io_uring on char devices as the block device io_uring interface is the generic block subsystem interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants