Draft: s3:smb2_server: add support for IORING_OP_RECVMSG and IORING_OP_SENDMSG

This makes use of IORING_OP_{RECVMSG,SENDMSG} via io_uring instead of using epoll_wait() and recvmsg/sendmsg().

The main benefit is that it's possible to move the kernel processing of the recvmsg/sendmsg processing into an io_uring worker thread using IOSQE_ASYNC, so that the memcpy into our userspace buffer doesn't block our main process. It also avoids unneeded wakeups for partial pdus.

This helps a lot with async workloads using multichannel.

In order to turn this on you a Linux kernel, strictly >= 5.4 for IORING_OP_{RECVMSG,SENDMSG} and >= 5.6 to use IOSQE_ASYNC, but better use >= 5.12.

In addition you need the following options in the global section of smb.conf:

      # This enabled io_uring usage in the smb2 server at all
      smb2srv:sconn_uring = true
      # This enabled the use of IORING_OP_RECVMSG
      smb2srv:recv_uring = true
      # This forces the use of IOSQE_ASYNC
      smb2srv:recvmsg_uring_async_threshold = 1
      # This enabled the use of IORING_OP_SENDMSG
      smb2srv:send_uring = true
      # This forces the use of IOSQE_ASYNC
      smb2srv:sendmsg_uring_async_threshold = 1

Checklist

  • Commits have Signed-off-by: with name/author being identical to the commit author
  • (optional) This MR is just one part towards a larger feature.
  • (optional, if backport required) Bugzilla bug filed and BUG: tag added
  • Test suite updated with functionality tests
  • Test suite updated with negative tests
  • Documentation updated
  • CI timeout is 3h or higher (see Settings/CICD/General pipelines/ Timeout)

Reviewer's checklist:

  • There is a test suite reasonably covering new functionality or modifications
  • Function naming, parameters, return values, types, etc., are consistent and according to README.Coding.md
  • This feature/change has adequate documentation added
  • No obvious mistakes in the code
Edited by Stefan Metzmacher

Merge request reports

Loading