nvme: apply user-specified timeout to all admin passthru commands#3302
Open
darkfiberiru wants to merge 1 commit intolinux-nvme:masterfrom
Open
nvme: apply user-specified timeout to all admin passthru commands#3302darkfiberiru wants to merge 1 commit intolinux-nvme:masterfrom
darkfiberiru wants to merge 1 commit intolinux-nvme:masterfrom
Conversation
Collaborator
|
I suggest something simpler, set timeout on the handle and use this value when submitting in ioctl.c: In v1 we passed the timeout value around using always the default value with a few exception. For special cases we can still do the approach you suggest, but I would like to avoid this if possible. |
4fc98fe to
22c96c0
Compare
Author
|
@igaw yes I see that's much cleaner. Sorry for brute force I will refactor |
22c96c0 to
820fa2f
Compare
The --timeout / -t flag is parsed into nvme_args.timeout but was only honored by format-nvm and admin-passthru. All other commands left cmd.timeout_ms at 0 (set by nvme_init_*() helpers), silently falling back to the kernel's admin_timeout (60s). Rather than adding cmd.timeout_ms assignments at every call site, set the timeout once on the transport handle in parse_and_open() and apply it in libnvme_submit_admin_passthru() and libnvme_submit_io_passthru() when the command's own timeout_ms is 0. Commands that set a non-zero timeout_ms (e.g. format's 600s default) are unaffected. This covers all built-in commands, all vendor plugins, and all internal libnvme callers (nvme-cmds.c, tree.c, fabrics.c) without requiring per-call-site changes. libnvme changes: - Add __u32 timeout field to struct libnvme_transport_handle - Add libnvme_transport_handle_set_timeout() public API - Apply handle timeout in submit_admin_passthru/submit_io_passthru - Export new symbol in LIBNVME_4 version section Signed-off-by: Nick Wolff <darkfiberiru@gmail.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
|
@igaw Updated |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The --timeout / -t flag is parsed into nvme_args.timeout but was only applied to format-nvm and admin-passthru. All other commands that use nvme_init_*() helpers followed by libnvme_submit_admin_passthru() had their timeout_ms left at 0 (memset by the init functions), silently falling back to the kernel's admin_timeout (60s).
This meant commands like delete-ns, create-ns, attach-ns, detach-ns, sanitize, fw-download, fw-commit, device-self-test, security-send, security-receive, capacity-mgmt, and all identify passthru commands ignored the user-supplied timeout.
Set cmd.timeout_ms = nvme_args.timeout after every nvme_init_*() call and before submission. When -t is not given, nvme_args.timeout is NVME_DEFAULT_IOCTL_TIMEOUT (0), preserving the existing kernel-default behavior.