Re: [PATCH v2 09/14] ublk: allow UBLK_IO_(UN)REGISTER_IO_BUF on any task
From: Ming Lei <hidden>
Date: 2025-06-23 09:07:39
From: Ming Lei <hidden>
Date: 2025-06-23 09:07:39
On Fri, Jun 20, 2025 at 09:10:03AM -0600, Caleb Sander Mateos wrote:
Currently, UBLK_IO_REGISTER_IO_BUF and UBLK_IO_UNREGISTER_IO_BUF are only permitted on the ublk_io's daemon task. But this restriction is unnecessary. ublk_register_io_buf() calls __ublk_check_and_get_req() to look up the request from the tagset and atomically take a reference on the request without accessing the ublk_io. ublk_unregister_io_buf() doesn't use the q_id or tag at all. So allow these opcodes even on tasks other than io->task. Handle UBLK_IO_UNREGISTER_IO_BUF before obtaining the ubq and io since the buffer index being unregistered is not necessarily related to the specified q_id and tag. Add a feature flag UBLK_F_BUF_REG_OFF_DAEMON that userspace can use to determine whether the kernel supports off-daemon buffer registration. Suggested-by: Ming Lei <redacted> Signed-off-by: Caleb Sander Mateos <redacted>
Reviewed-by: Ming Lei <redacted> Thanks, Ming