From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:57698 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751081AbdJMV02 (ORCPT ); Fri, 13 Oct 2017 17:26:28 -0400 Date: Fri, 13 Oct 2017 17:26:26 -0400 From: "J. Bruce Fields" To: Olga Kornievskaia Cc: linux-nfs@vger.kernel.org Subject: Re: [PATCH v5 00/10] NFSD support for asynchronous COPY Message-ID: <20171013212626.GB28854@parsley.fieldses.org> References: <20171013205412.65532-1-kolga@netapp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <20171013205412.65532-1-kolga@netapp.com> Sender: linux-nfs-owner@vger.kernel.org List-ID: On Fri, Oct 13, 2017 at 04:54:02PM -0400, Olga Kornievskaia wrote: > To do asynchronous copies, NFSD creates a new kthread to handle the request. > Upon receiving the COPY, it generates a unique copy stateid (stored in a > global list for keeping track of state for OFFLOAD_STATUS to be queried by), > starts the thread, and replies back to the client. nfsd4_copy arguments that > are allocated on the stack are copies for the kthread. > > In the async copy handler, it calls into VFS copy_file_range() (for synch > we keep the 4MB chunk and requested size for the async copy). If error is > encountered it's saved but also we save the amount of data copied so far. > Once done, the results are queued for the callback workqueue and sent via > CB_OFFLOAD. > > When the server received an OFFLOAD_CANCEL, it will find the kthread running > the copy and will send a SIGPENDING and kthread_stop() and it will interrupt > the ongoing do_splice() and once vfs returns we are choosing not to send > the CB_OFFLOAD back to the client. > > When the server receives an OFFLOAD_STATUS, it will find the kthread running > the copy and will query the i_size_read() of the associated filehandle of > the destination file and return the result. That assumes we're copying into a previously empty file? --b. > > v5: > 1. reimplementing asynchronous copy to use kthreads instead of the workqueue > 2. store asynchronous copies in the list of the nfs4_client structure > 3. when copying nfsd4_copy datastructure for the async copy refcount the > nfs4_client structure as well as struct file src/dst structure > 4. add refcount to the nfsd4_copy structure to coordinate with offload_status > and offload_cancel > 5. offload_cancel/copy_shutdown sets the SIGPENDING in the copy's thread to > interrupt do_splice and calls kthread_stop to wait for the copy to stop > 6. offload_cancel adds MODIFIES_SOMETHING to flags > 7. offload_status reports the size of the destination file form i_size_read() > instead of before 4MB loop updated chunk size. > 8. for async copy call vfs_copy_file_range() with the whole copy size. still > keep the loop to do more the MAX_RW_COUNT that do_splice can do. > > Olga Kornievskaia (10): > NFSD CB_OFFLOAD xdr > NFSD OFFLOAD_STATUS xdr > NFSD OFFLOAD_CANCEL xdr > NFSD xdr callback stateid in async COPY reply > NFSD first draft of async copy > NFSD return nfs4_stid in nfs4_preprocess_stateid_op > NFSD create new stateid for async copy > NFSD handle OFFLOAD_CANCEL op > NFSD support OFFLOAD_STATUS > NFSD stop queued async copies on client shutdown > > fs/nfsd/netns.h | 8 ++ > fs/nfsd/nfs4callback.c | 97 +++++++++++++++ > fs/nfsd/nfs4proc.c | 321 ++++++++++++++++++++++++++++++++++++++++++++----- > fs/nfsd/nfs4state.c | 77 +++++++++++- > fs/nfsd/nfs4xdr.c | 50 ++++++-- > fs/nfsd/nfsctl.c | 1 + > fs/nfsd/state.h | 21 +++- > fs/nfsd/xdr4.h | 28 +++++ > fs/nfsd/xdr4cb.h | 10 ++ > 9 files changed, 576 insertions(+), 37 deletions(-) > > -- > 1.8.3.1 >