From: David Howells <dhowells@redhat.com>
To: Stefan Metzmacher <metze@samba.org>
Cc: dhowells@redhat.com,
"linux-cifs@vger.kernel.org" <linux-cifs@vger.kernel.org>,
netfs@lists.linux.dev,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
Steve French <stfrench@microsoft.com>
Subject: Re: [PATCH] cifs: Collapse smbd_recv_*() into smbd_recv() and just use copy_to_iter()
Date: Tue, 24 Jun 2025 15:22:51 +0100 [thread overview]
Message-ID: <1156127.1750774971@warthog.procyon.org.uk> (raw)
In-Reply-To: <f448a729-ca2e-40a8-be67-3334f47a3916@samba.org>
Stefan Metzmacher <metze@samba.org> wrote:
> > read_rfc1002_done:
> > + /* SMBDirect will read it all or nothing */
> > + msg->msg_iter.count = 0;
>
> And this iov_iter_truncate(0);
Actually, it should probably have been iov_iter_advance().
> While I'm wondering why we had this at all.
>
> It seems all callers of cifs_read_iter_from_socket()
> don't care and the code path via sock_recvmsg() doesn't
> truncate it just calls copy_to_iter() via this chain:
> ->inet_recvmsg->tcp_recvmsg->skb_copy_datagram_msg->skb_copy_datagram_iter
> ->simple_copy_to_iter->copy_to_iter()
>
> I think the old code should have called
> iov_iter_advance(rc) instead of msg->msg_iter.count = 0.
>
> But the new code doesn't need it as copy_to_iter()
> calls iterate_and_advance().
Yeah, it should. I seem to remember that there were situations in which it
didn't, but it's possible I managed to get rid of them.
> > - default:
> > - /* It's a bug in upper layer to get there */
> > - cifs_dbg(VFS, "Invalid msg type %d\n",
> > - iov_iter_type(&msg->msg_iter));
> > - rc = -EINVAL;
> > - }
>
> I guess this is actually a real fix as I just saw
> CIFS: VFS: Invalid msg type 4
> in logs while running the cifs/001 test.
> And 4 is ITER_FOLIOQ.
Ah... Were you using "-o seal"? The encrypted data is held in a buffer formed
from a folioq with a series of folios in it.
David
next prev parent reply other threads:[~2025-06-24 14:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-23 13:04 [PATCH] cifs: Collapse smbd_recv_*() into smbd_recv() and just use copy_to_iter() David Howells
2025-06-24 12:25 ` Stefan Metzmacher
2025-06-24 14:22 ` David Howells [this message]
2025-06-24 16:05 ` Stefan Metzmacher
2025-06-25 8:07 ` Stefan Metzmacher
2025-06-25 10:10 ` Stefan Metzmacher
2025-06-25 11:25 ` David Howells
2025-06-25 11:51 ` Stefan Metzmacher
2025-06-25 12:47 ` David Howells
2025-06-25 14:18 ` Stefan Metzmacher
2025-06-25 16:00 ` 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=1156127.1750774971@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=metze@samba.org \
--cc=netfs@lists.linux.dev \
--cc=stfrench@microsoft.com \
/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