From: Michal Pecio <michal.pecio@gmail.com>
To: Oliver Neukum <oneukum@suse.com>
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH] usb: translate ENOSPC for user space
Date: Thu, 26 Mar 2026 07:27:35 +0100 [thread overview]
Message-ID: <20260326072735.67707e66.michal.pecio@gmail.com> (raw)
In-Reply-To: <20260325145537.372993-1-oneukum@suse.com>
On Wed, 25 Mar 2026 15:55:20 +0100, Oliver Neukum wrote:
> In case of insufficient bandwidth usb_submit_urb()
> returns -ENOSPC. Translating this to -EIO is not
> optimal. There are insufficient resources not
> an error. EBUSY is a better fit.
>
> Signed-off-by: Oliver Neukum <oneukum@suse.com>
> ---
> include/linux/usb.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/include/linux/usb.h b/include/linux/usb.h
> index 04277af4bb9d..815f2212936e 100644
> --- a/include/linux/usb.h
> +++ b/include/linux/usb.h
> @@ -2075,6 +2075,8 @@ static inline int usb_translate_errors(int error_code)
> case -ENODEV:
> case -EOPNOTSUPP:
> return error_code;
> + case -ENOSPC:
> + return -EBUSY;
> default:
> return -EIO;
> }
This function is used by serial drivers in syscalls like "set/get modem
control" and apparently also "write/read data" in cdc-wdm.
So when they fail because the USB I/O failed, does userspace really
care whether the I/O failed due to insufficient USB resources?
Are those syscalls documented to return EBUSY and is userspace expected
to handle it better than EIO in those particular cases?
I would assume that EBUSY means too many processes are trying to do too
many thing with this tty at once, and that's not the case. My recovery
might be to find such processes and kill them, and it wouldn't help.
What real world improvement was achieved? ;)
Does it ever happen? ENOSPC applies to periodic URBs, but that code
looks like sometihng that would end up using control or bulk.
Regards,
Michal
prev parent reply other threads:[~2026-03-26 6:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-25 14:55 [PATCH] usb: translate ENOSPC for user space Oliver Neukum
2026-03-26 6:27 ` Michal Pecio [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260326072735.67707e66.michal.pecio@gmail.com \
--to=michal.pecio@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-usb@vger.kernel.org \
--cc=oneukum@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox