Stefan Metzmacher <metze@xxxxxxxxx> 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