Skip to content

improve smbdirect_mr_io lifetime

Stefan Metzmacher linux-cifs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest10 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10smb: smbdirect: introduce smbdirect_mr_io.{kref,mutex} and SMBDIRECT_MR_DISABLEDfs/smb/common/smbdirect/smbdirect_socket.h+10 -10 replies
2/10smb: client: change smbd_deregister_mr() to return voidfs/smb/client/smbdirect.c fs/smb/client/smbdirect.h+2 -40 replies
3/10smb: client: let destroy_mr_list() call list_del(&mr->list)fs/smb/client/smbdirect.c+1 -00 replies
4/10smb: client: let destroy_mr_list() remove locked from the listfs/smb/client/smbdirect.c+8 -10 replies
5/10smb: client: improve logic in allocate_mr_list()fs/smb/client/smbdirect.c+35 -300 replies
6/10smb: client: improve logic in smbd_register_mr()fs/smb/client/smbdirect.c+23 -290 replies
7/10smb: client: improve logic in smbd_deregister_mr()fs/smb/client/smbdirect.c+16 -190 replies
8/10smb: client: call ib_dma_unmap_sg if mr->sgt.nents is not 0fs/smb/client/smbdirect.c+8 -40 replies
9/10smb: client: let destroy_mr_list() call ib_dereg_mr() before ib_dma_unmap_sg()fs/smb/client/smbdirect.c+2 -10 replies
10/10smb: client: let destroy_mr_list() keep smbdirect_mr_io memory if registeredfs/smb/client/smbdirect.c+126 -192 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 00/10] improve smbdirect_mr_io lifetime

Hi,

these patches improve and simplify our handling of smbdirect_mr_io structures and their lifetime.

smbd_register_mr() returns a pointer to struct smbdirect_mr_io and smbd_deregister_mr() gives the pointer back.

But currently the memory itself is managed by the connection (struct smbdirect_socket) and smbd_destroy() has a strange wait loop in order to wait for smbd_deregister_mr() being called. It means code in smbd_destroy() is aware of the server mutex in the generic smb client handling above the transport layer.

These patches do some cleanups and fixes before changing the logic to use a kref and a mutex in order to allow smbd_deregister_mr() being called after smbd_destroy() as the memory of smbdirect_mr_io will stay in memory but will be detached from the connection.

This makes the code independent of cifs_server_[un]lock() and will allow us to move more smbdirect code into common functions (shared between client and server).

I think these should go into 6.18.

Stefan Metzmacher (10):
smb: smbdirect: introduce smbdirect_mr_io.{kref,mutex} and
SMBDIRECT_MR_DISABLED
smb: client: change smbd_deregister_mr() to return void
smb: client: let destroy_mr_list() call list_del(&mr->list)
smb: client: let destroy_mr_list() remove locked from the list
smb: client: improve logic in allocate_mr_list()
smb: client: improve logic in smbd_register_mr()
smb: client: improve logic in smbd_deregister_mr()
smb: client: call ib_dma_unmap_sg if mr->sgt.nents is not 0
smb: client: let destroy_mr_list() call ib_dereg_mr() before

    ib_dma_unmap_sg()

smb: client: let destroy_mr_list() keep smbdirect_mr_io memory if
registered

 fs/smb/client/smbdirect.c                  | 312 ++++++++++++++-------
 fs/smb/client/smbdirect.h                  |   2 +-
 fs/smb/common/smbdirect/smbdirect_socket.h |  11 +-
 3 files changed, 224 insertions(+), 101 deletions(-)
Signature · 1 line
2.43.0