This is a mechanical change of the prototype of smbd_register_mr() to take a struct TCP_Server_Info *server instead of a struct smbd_connection *, deriving server->smbd_conn inside the function, with no change in behaviour. A following change uses this to take a reference on server->smbd_conn's socket under server->srv_lock. Fixes: b8aef8c8808c ("smb: client: make use of smbdirect_socket_create_kern()/smbdirect_socket_release()") Cc: stable@vger.kernel.org Cc: Paulo Alcantara Cc: Namjae Jeon Cc: Tom Talpey Cc: linux-cifs@vger.kernel.org Cc: samba-technical@lists.samba.org Cc: Ronnie Sahlberg Cc: Shyam Prasad N Cc: Bharath SM Signed-off-by: Stefan Metzmacher --- fs/smb/client/smb2pdu.c | 4 ++-- fs/smb/client/smbdirect.c | 3 ++- fs/smb/client/smbdirect.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/fs/smb/client/smb2pdu.c b/fs/smb/client/smb2pdu.c index 7b7d25364e20..d56e84770615 100644 --- a/fs/smb/client/smb2pdu.c +++ b/fs/smb/client/smb2pdu.c @@ -4721,7 +4721,7 @@ int smb2_new_read_req(void **buf, unsigned int *total_len, struct smbdirect_buffer_descriptor_v1 *v1; bool need_invalidate = server->dialect == SMB30_PROT_ID; - rdata->mr = smbd_register_mr(server->smbd_conn, &rdata->subreq.io_iter, + rdata->mr = smbd_register_mr(server, &rdata->subreq.io_iter, true, need_invalidate); if (!rdata->mr) { rc = -EAGAIN; @@ -5362,7 +5362,7 @@ smb2_async_writev(struct cifs_io_subrequest *wdata) struct smbdirect_buffer_descriptor_v1 *v1; bool need_invalidate = server->dialect == SMB30_PROT_ID; - wdata->mr = smbd_register_mr(server->smbd_conn, &wdata->subreq.io_iter, + wdata->mr = smbd_register_mr(server, &wdata->subreq.io_iter, false, need_invalidate); if (!wdata->mr) { rc = -EAGAIN; diff --git a/fs/smb/client/smbdirect.c b/fs/smb/client/smbdirect.c index b00224a1d411..9fe92db606ad 100644 --- a/fs/smb/client/smbdirect.c +++ b/fs/smb/client/smbdirect.c @@ -545,10 +545,11 @@ int smbd_send(struct TCP_Server_Info *server, * need_invalidate: true if this MR needs to be locally invalidated after I/O * return value: the MR registered, NULL if failed. */ -struct smbdirect_mr_io *smbd_register_mr(struct smbd_connection *info, +struct smbdirect_mr_io *smbd_register_mr(struct TCP_Server_Info *server, struct iov_iter *iter, bool writing, bool need_invalidate) { + struct smbd_connection *info = server->smbd_conn; struct smbdirect_socket *sc = info->socket; if (!smbdirect_connection_is_connected(sc)) diff --git a/fs/smb/client/smbdirect.h b/fs/smb/client/smbdirect.h index 81fd6b849ade..7d99797de6fa 100644 --- a/fs/smb/client/smbdirect.h +++ b/fs/smb/client/smbdirect.h @@ -47,7 +47,7 @@ int smbd_send(struct TCP_Server_Info *server, /* Interfaces to register and deregister MR for RDMA read/write */ struct smbdirect_mr_io *smbd_register_mr( - struct smbd_connection *info, struct iov_iter *iter, + struct TCP_Server_Info *server, struct iov_iter *iter, bool writing, bool need_invalidate); void smbd_mr_fill_buffer_descriptor(struct smbdirect_mr_io *mr, struct smbdirect_buffer_descriptor_v1 *v1); -- 2.43.0