mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
ublk: allow UBLK_IO_(UN)REGISTER_IO_BUF on any task
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 <ming.lei@redhat.com> Signed-off-by: Caleb Sander Mateos <csander@purestorage.com> Reviewed-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20250620151008.3976463-10-csander@purestorage.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
committed by
Jens Axboe
parent
2da1e7bb3f
commit
763ff02ce2
@@ -301,6 +301,16 @@
|
||||
*/
|
||||
#define UBLK_F_PER_IO_DAEMON (1ULL << 13)
|
||||
|
||||
/*
|
||||
* If this feature is set, UBLK_U_IO_REGISTER_IO_BUF/UBLK_U_IO_UNREGISTER_IO_BUF
|
||||
* can be issued for an I/O on any task. q_id and tag are also ignored in
|
||||
* UBLK_U_IO_UNREGISTER_IO_BUF's ublksrv_io_cmd.
|
||||
* If it is unset, zero-copy buffers can only be registered and unregistered by
|
||||
* the I/O's daemon task. The q_id and tag of the registered buffer are required
|
||||
* in UBLK_U_IO_UNREGISTER_IO_BUF's ublksrv_io_cmd.
|
||||
*/
|
||||
#define UBLK_F_BUF_REG_OFF_DAEMON (1ULL << 14)
|
||||
|
||||
/* device state */
|
||||
#define UBLK_S_DEV_DEAD 0
|
||||
#define UBLK_S_DEV_LIVE 1
|
||||
|
||||
Reference in New Issue
Block a user