linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: dhowells@redhat.com, Steve French <smfrench@gmail.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-cifs@vger.kernel.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Steve French <sfrench@samba.org>
Subject: Re: [RFC 08/13] cifs: Add a function to read into an iter from a socket
Date: Thu, 26 Jan 2023 15:44:01 +0000	[thread overview]
Message-ID: <2862713.1674747841@warthog.procyon.org.uk> (raw)
In-Reply-To: <0d53a3cc9f9448298bba04d06f51b23d@AcuMS.aculab.com>

David Laight <David.Laight@ACULAB.COM> wrote:

> On the face of it that passes a largely uninitialised 'struct msghdr'
> to cifs_readv_from_socket() in order to pass an iov_iter.
> That seems to be asking for trouble.
> 
> If cifs_readv_from_socket() only needs the iov_iter then wouldn't
> it be better to do the wrapper the other way around?
> (Probably as an inline function)
> Something like:
> 
> int
> cifs_readv_from_socket(struct TCP_Server_Info *server, struct msghdr *smb_msg)
> {
> 	return cifs_read_iter_from_socket(server, &smb_msg->msg_iter, smb_msg->msg_iter.count);
> }
> 
> and then changing cifs_readv_from_socket() to just use the iov_iter.

Yeah.  And smbd_recv() only cares about the iterator too.

> I'm also not 100% sure that taking a copy of an iov_iter is a good idea.

It shouldn't matter as the only problematic iterator is ITER_PIPE (advancing
that has side effects) - and splice_read is handled specially by patch 4.  The
problem with splice_read with the way cifs works is that it likes to subdivide
its read/write requests across multiple reqs and then subsubdivide them if
certain types of failure occur.  But you can't do that with ITER_PIPE.

I build an ITER_BVEC from ITER_PIPE, ITER_UBUF and ITER_IOVEC in the top
levels with pins inserted as appropriate and hand the ITER_BVEC down.  For
user-backed iterators it has to be done this way because the I/O may get
shuffled off to a different thread.

Reqs can then just copy the BVEC/XARRAY/KVEC and narrow the region because the
master request at the top does holds the vector list and the top cifs level or
the caller above the vfs (eg. sys_execve) does what is necessary to retain the
pages.

David


  parent reply	other threads:[~2023-01-26 15:45 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-25 21:45 [RFC 00/13] smb3: Use iov_iters down to the network transport and fix DIO page pinning David Howells
2023-01-25 21:45 ` [RFC 01/13] netfs: Add a function to extract a UBUF or IOVEC into a BVEC iterator David Howells
2023-01-25 21:45 ` [RFC 02/13] netfs: Add a function to extract an iterator into a scatterlist David Howells
2023-01-25 21:45 ` [RFC 03/13] cifs: Fix oops due to uncleared server->smbd_conn in reconnect David Howells
2023-01-25 21:45 ` [RFC 04/13] cifs: Implement splice_read to pass down ITER_BVEC not ITER_PIPE David Howells
2023-01-25 21:45 ` [RFC 05/13] cifs: Add a function to build an RDMA SGE list from an iterator David Howells
2023-01-25 21:45 ` [RFC 06/13] cifs: Add a function to Hash the contents of " David Howells
2023-01-27 10:27   ` Herbert Xu
2023-01-27 10:33     ` David Howells
2023-01-27 10:38       ` Herbert Xu
2023-01-25 21:45 ` [RFC 07/13] cifs: Add some helper functions David Howells
2023-01-25 21:45 ` [RFC 08/13] cifs: Add a function to read into an iter from a socket David Howells
2023-01-26  9:27   ` David Laight
2023-01-26 15:44   ` David Howells [this message]
2023-01-26 16:09     ` David Laight
2023-01-26 16:41     ` David Howells
2023-01-25 21:45 ` [RFC 09/13] cifs: Change the I/O paths to use an iterator rather than a page list David Howells
2023-01-25 21:45 ` [RFC 10/13] cifs: Build the RDMA SGE list directly from an iterator David Howells
2023-01-25 21:45 ` [RFC 11/13] cifs: Remove unused code David Howells
2023-01-25 21:45 ` [RFC 12/13] cifs: Fix problem with encrypted RDMA data read David Howells
2023-01-25 21:45 ` [RFC 13/13] cifs: DIO to/from KVEC-type iterators should now work 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=2862713.1674747841@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=David.Laight@ACULAB.COM \
    --cc=hch@infradead.org \
    --cc=jlayton@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=metze@samba.org \
    --cc=nspmangalore@gmail.com \
    --cc=rohiths.msft@gmail.com \
    --cc=sfrench@samba.org \
    --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;
as well as URLs for NNTP newsgroup(s).