From: David Howells <dhowells@redhat.com>
To: Steve French <smfrench@gmail.com>
Cc: David Howells <dhowells@redhat.com>,
Al Viro <viro@zeniv.linux.org.uk>,
Shyam Prasad N <nspmangalore@gmail.com>,
Rohith Surabattula <rohiths.msft@gmail.com>,
Tom Talpey <tom@talpey.com>, Stefan Metzmacher <metze@samba.org>,
Christoph Hellwig <hch@infradead.org>,
Matthew Wilcox <willy@infradead.org>,
Jeff Layton <jlayton@kernel.org>,
linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org, Long Li <longli@microsoft.com>,
Namjae Jeon <linkinjeon@kernel.org>
Subject: [PATCH 11/11] cifs: Fix problem with encrypted RDMA data read
Date: Fri, 10 Feb 2023 23:32:05 +0000 [thread overview]
Message-ID: <20230210233205.1517459-12-dhowells@redhat.com> (raw)
In-Reply-To: <20230210233205.1517459-1-dhowells@redhat.com>
When the cifs client is talking to the ksmbd server by RDMA and the ksmbd
server has "smb3 encryption = yes" in its config file, the normal PDU
stream is encrypted, but the directly-delivered data isn't in the stream
(and isn't encrypted), but is rather delivered by DDP/RDMA packets (at
least with IWarp).
Currently, the direct delivery fails with:
buf can not contain only a part of read data
WARNING: CPU: 0 PID: 4619 at fs/cifs/smb2ops.c:4731 handle_read_data+0x393/0x405
...
RIP: 0010:handle_read_data+0x393/0x405
...
smb3_handle_read_data+0x30/0x37
receive_encrypted_standard+0x141/0x224
cifs_demultiplex_thread+0x21a/0x63b
kthread+0xe7/0xef
ret_from_fork+0x22/0x30
The problem apparently stemming from the fact that it's trying to manage
the decryption, but the data isn't in the smallbuf, the bigbuf or the page
array).
This can be fixed simply by inserting an extra case into handle_read_data()
that checks to see if use_rdma_mr is true, and if it is, just setting
rdata->got_bytes to the length of data delivered and allowing normal
continuation.
This can be seen in an IWarp packet trace. With the upstream code, it does
a DDP/RDMA packet, which produces the warning above and then retries,
retrieving the data inline, spread across several SMBDirect messages that
get glued together into a single PDU. With the patch applied, only the
DDP/RDMA packet is seen.
Note that this doesn't happen if the server isn't told to encrypt stuff and
it does also happen with softRoCE.
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Steve French <smfrench@gmail.com>
cc: Tom Talpey <tom@talpey.com>
cc: Long Li <longli@microsoft.com>
cc: Namjae Jeon <linkinjeon@kernel.org>
cc: Stefan Metzmacher <metze@samba.org>
cc: linux-cifs@vger.kernel.org
Link: https://lore.kernel.org/r/166855224228.1998592.2212551359609792175.stgit@warthog.procyon.org.uk/ # v1
---
fs/cifs/smb2ops.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
index 744cd7374a43..636175850ca7 100644
--- a/fs/cifs/smb2ops.c
+++ b/fs/cifs/smb2ops.c
@@ -4734,6 +4734,9 @@ handle_read_data(struct TCP_Server_Info *server, struct mid_q_entry *mid,
if (length < 0)
return length;
rdata->got_bytes = data_len;
+ } else if (use_rdma_mr) {
+ /* The data was delivered directly by RDMA. */
+ rdata->got_bytes = data_len;
} else {
/* read response payload cannot be in both buf and pages */
WARN_ONCE(1, "buf can not contain only a part of read data");
next prev parent reply other threads:[~2023-02-10 23:35 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-10 23:31 [PATCH 00/11] smb3: Use iov_iters down to the network transport and fix DIO page pinning David Howells
2023-02-10 23:31 ` [PATCH 01/11] netfs: Add a function to extract a UBUF or IOVEC into a BVEC iterator David Howells
2023-02-10 23:31 ` [PATCH 02/11] netfs: Add a function to extract an iterator into a scatterlist David Howells
2023-02-10 23:31 ` [PATCH 03/11] cifs: Add a function to build an RDMA SGE list from an iterator David Howells
2023-02-10 23:31 ` [PATCH 04/11] cifs: Add a function to Hash the contents of " David Howells
2023-02-10 23:31 ` [PATCH 05/11] cifs: Add some helper functions David Howells
2023-02-10 23:32 ` [PATCH 06/11] cifs: Add a function to read into an iter from a socket David Howells
2023-02-10 23:32 ` [PATCH 08/11] cifs: Build the RDMA SGE list directly from an iterator David Howells
2023-02-10 23:32 ` [PATCH 09/11] cifs: Remove unused code David Howells
2023-02-10 23:32 ` [PATCH 10/11] cifs: DIO to/from KVEC-type iterators should now work David Howells
2023-02-10 23:32 ` David Howells [this message]
2023-02-12 23:39 ` [PATCH 11/11] cifs: Fix problem with encrypted RDMA data read David Howells
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230210233205.1517459-12-dhowells@redhat.com \
--to=dhowells@redhat.com \
--cc=hch@infradead.org \
--cc=jlayton@kernel.org \
--cc=linkinjeon@kernel.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=longli@microsoft.com \
--cc=metze@samba.org \
--cc=nspmangalore@gmail.com \
--cc=rohiths.msft@gmail.com \
--cc=smfrench@gmail.com \
--cc=tom@talpey.com \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox