Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[WIP] udiskslinuxdrive: Calculate drive size from all attached NVMe namespaces #1230

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tbzatek
Copy link
Member

@tbzatek tbzatek commented Nov 30, 2023

In case capacity reporting is not supported by the NVMe controller, calculate the drive size from the currently attached namespaces as a workaround.

This presents a chicken-egg problem when not all block objects are present at the time the drive size calculation is done. So ping the drive object back once a namespace interface is published, and on all subsequent uevents (e.g. as a result of LBA format change). Since the pingback is queued in the main loop, the drive Size property gets updates slightly later.

Fixes #1194

TODO:

  • handle namespace detach (uevent remove) event

In case capacity reporting is not supported by the NVMe controller,
calculate the drive size from the currently attached namespaces
as a workaround.

This presents a chicken-egg problem when not all block objects are
present at the time the drive size calculation is done. So ping
the drive object back once a namespace interface is published,
and on all subsequent uevents (e.g. as a result of LBA format
change). Since the pingback is queued in the main loop, the drive
Size property gets updates slightly later.
@tbzatek tbzatek changed the title udiskslinuxdrive: Calculate drive size from all attached NVMe namespaces [WIP] udiskslinuxdrive: Calculate drive size from all attached NVMe namespaces Jun 3, 2024
@BrainBlasted
Copy link

We hit this issue upstream in GNOME with our testing system (GNOME OS). Applying this patch seems to fix the issue.

@seb128
Copy link
Contributor

seb128 commented Nov 8, 2024

@tbzatek in case extra feedback is helping, we put that patch in a ppa for Ubuntu and got some users confirming it's working for them (https://bugs.launchpad.net/udisks/+bug/2038761).

Since it's an issue which is often raised by our users I will go ahead and apply it also as a distro patch in our devel serie now. Is there anything we can do to help getting that work landed upstream?

@tbzatek
Copy link
Member Author

tbzatek commented Dec 18, 2024

Thanks Sebastien, this is a useful feedback. As long as consumer-level NVMe drives typically expose just a single namespace, we need to make sure this approach works for drives that offer namespace management and for NVMe over Fabrics-connected resources.

I still need to rework the patch to make it less hacky and make use of finer-granularity object hooks (#1233), however the way of size computation wouldn't likely change. Feel free to ship the patch for the moment.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cant detect disk size
4 participants