* [PATCH] usb: translate ENOSPC for user space
@ 2026-03-25 14:55 Oliver Neukum
2026-03-26 6:27 ` Michal Pecio
0 siblings, 1 reply; 2+ messages in thread
From: Oliver Neukum @ 2026-03-25 14:55 UTC (permalink / raw)
To: gregkh, linux-usb; +Cc: Oliver Neukum
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;
}
--
2.53.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] usb: translate ENOSPC for user space
2026-03-25 14:55 [PATCH] usb: translate ENOSPC for user space Oliver Neukum
@ 2026-03-26 6:27 ` Michal Pecio
0 siblings, 0 replies; 2+ messages in thread
From: Michal Pecio @ 2026-03-26 6:27 UTC (permalink / raw)
To: Oliver Neukum; +Cc: gregkh, linux-usb
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-26 6:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-25 14:55 [PATCH] usb: translate ENOSPC for user space Oliver Neukum
2026-03-26 6:27 ` Michal Pecio
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox