Re: [PATCH] cifs: Fix problem with encrypted RDMA data read
From: Stefan Metzmacher
Date: Wed Nov 16 2022 - 07:53:43 EST
Am 16.11.22 um 13:14 schrieb David Howells:
Stefan Metzmacher <metze@xxxxxxxxx> wrote:
Stefan Metzmacher <metze@xxxxxxxxx> wrote:
I'm not sure I understand why this would fix anything when encryption is
enabled.
Is the payload still be offloaded as plaintext? Otherwise we wouldn't have
use_rdma_mr... So this rather looks like a fix for the non encrypted case.
The "inline"[*] PDUs are encrypted, but the direct RDMA data transmission is
not. I'm not sure if this is a bug in ksmbd.
It's a bug in the client!
Well, if you can fix it the right way, I can test the patch. I'm not sure
what that would be if not what I suggested.
As written in the other mail something like this:
fs/cifs/smb2pdu.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index a5695748a89b..d478b0a89890 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -4090,7 +4090,7 @@ smb2_new_read_req(void **buf, unsigned int *total_len,
* If we want to do a RDMA write, fill in and append
* smbd_buffer_descriptor_v1 to the end of read request
*/
- if (server->rdma && rdata && !server->sign &&
+ if (server->rdma && rdata && !server->sign && !smb3_encryption_required(io_parms->tcon) &&
rdata->bytes >= server->smbd_conn->rdma_readwrite_threshold) {
struct smbd_buffer_descriptor_v1 *v1;
@@ -4517,8 +4517,8 @@ smb2_async_writev(struct cifs_writedata *wdata,
* If we want to do a server RDMA read, fill in and append
* smbd_buffer_descriptor_v1 to the end of write request
*/
- if (server->rdma && !server->sign && wdata->bytes >=
- server->smbd_conn->rdma_readwrite_threshold) {
+ if (server->rdma && !server->sign && !smb3_encryption_required(tcon) &&
+ wdata->bytes >= server->smbd_conn->rdma_readwrite_threshold) {
struct smbd_buffer_descriptor_v1 *v1;
bool need_invalidate = server->dialect == SMB30_PROT_ID;