Option to never do BLKRRPART ioctl in nvme format?

Nick Neumann nick at pcpartpicker.com
Fri Jan 6 11:28:52 PST 2023


The nvme format command, as its documentation states, issues BLKRRPART
ioctl after successful format.

It feels odd that after a successful format, the format command can
still return an error code because BLKRRPART ioctl fails.

When initially added, the BLKRRPART ioctl was issued but its return
value was ignored. Later[1], the return value started being checked
and returned. And over time [2,3], cases were added where BLKRRPART is
not issued.

I'm wondering if all of this, combined with apparent race conditions
I've hit where BLKRRPART can fail after successful format, are a sign
that there should be a way to do an nvme format without BLKRRPART
ioctl.

Maybe format should have an option to not do BLKRRPART and instead
just always do NVME_IOCTL_RESCAN ? Then the caller can issue BLKRRPART
ioctl themselves if they need it to happen?

[1]: https://github.com/linux-nvme/nvme-cli/commit/adf01d2d6a03c5e48380004cb4971a5b9ef89b4a
the return value started being checked and returned.

[2]: https://github.com/linux-nvme/nvme-cli/commit/46e0baea19b7ed8f6f9c639f8da82d2bb944c561
BLKRRPART ioctl is skipped when lbaf is the same or all namespaces are formatted

[3]: https://github.com/linux-nvme/nvme-cli/commit/6420c58b510ddba290500d9b75fef9e9c980e0c1
BLKRRPART ioctl is not done when a character device is used.



More information about the Linux-nvme mailing list