All of lore.kernel.org
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@redhat.com>
To: Olga Kornievskaia <aglo@umich.edu>
Cc: "J. Bruce Fields" <bfields@fieldses.org>,
	Olga Kornievskaia <kolga@netapp.com>,
	linux-nfs <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH v7 10/10] NFSD stop queued async copies on client shutdown
Date: Thu, 12 Apr 2018 16:06:37 -0400	[thread overview]
Message-ID: <20180412200636.GB29609@parsley.fieldses.org> (raw)
In-Reply-To: <CAN-5tyFrwJeSGOt50euTCN_G9H5naiWSpyHLvFcQm8uV0YPUBg@mail.gmail.com>

On Thu, Apr 12, 2018 at 04:05:39PM -0400, Olga Kornievskaia wrote:
> On Wed, Apr 11, 2018 at 1:33 PM, J. Bruce Fields <bfields@redhat.com> wrote:
> > On Tue, Apr 10, 2018 at 05:13:07PM -0400, J. Bruce Fields wrote:
> >> On Tue, Apr 10, 2018 at 05:07:02PM -0400, Olga Kornievskaia wrote:
> >> > On Tue, Apr 10, 2018 at 4:21 PM, J. Bruce Fields <bfields@redhat.com> wrote:
> >> > > DESTROY_CLIENTID doesn't throw away all the client's state for it, it's
> >> > > only meant to be called after the client has already cleaned up
> >> > > everything else.  So:
> >> > >
> >> > >         https://tools.ietf.org/html/rfc5661#section-18.50.3
> >> > >
> >> > >         If there are sessions (both idle and non-idle), opens, locks,
> >> > >         delegations, layouts, and/or wants (Section 18.49) associated
> >> > >         with the unexpired lease of the client ID, the server MUST
> >> > >         return NFS4ERR_CLIENTID_BUSY.
> >> > >
> >> > > My feeling is that "ongoing copies" also belongs on that list.
> >
> > And come to think of it we should actually be adding that check to
> > client_has_state()--it should return clientid_busy if there are any
> > copies in progress.
> >
> >> > > So the server behavior you're seeing sounds correct to me--the client
> >> > > should cancel any ongoing copies before calling DESTROY_CLIENTID.
> >> >
> >> > If the behavior of returning ERR_DELAY until the copy is done is
> >> > correct one, then I don't think I need this patch at all. Since copy
> >> > takes a reference on the nfs4_client structure, then in
> >> > __destroy_client() where nfsd4_shutdown_copy() is called the list will
> >> > always be empty.
> >>
> >> Actually I guess it should be returning CLIENTID_BUSY.  Maybe that's a
> >> preexisting bug.
> >
> > So the copy should be caught by the earlier client_has_state() check
> > before it gets to the later mark_client_expired_locked().
> >
> > And after reminding myself how this works....  We only hold references
> > on clients temporarily such as while we're actually processing an RPC
> > from a client.
> >
> > An elevated cl_refcount prevents the server from removing the client
> > even after the lease expires, or after the client reboots and attempts
> > to clear its old state with a new EXCHANGE_ID/CREATE_SESSION.  I don't
> > think that's what we want.  Clients still need to renew their lease in
> > the usual way, a long-running async copy doesn't keep the lease renewed
> > automatically.
> >
> > So, the asynchronous copy shouldn't hold a reference on the client.
> >
> > The copy thread can still safely use the client while it's running,
> > because it knows that anyone destroying the client will first cancel the
> > copy and wait for the thread to die.
> 
> Ok no reference on the client. I will add a check to
> client_has_state() to check for on-going copies and then server would
> return CLIENTID_BUSY. What was already in the patch was that during
> client shutdown it would stop copies. I have tested for when the
> server is expiring client's lease, it also shuts down any on-going
> copies. I think I'm ready for the next version submission...

OK, great.--b.

      reply	other threads:[~2018-04-12 20:06 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-20 16:42 [PATCH v7 00/10] NFSD support for asynchronous COPY Olga Kornievskaia
2018-02-20 16:42 ` [PATCH v7 01/10] NFSD CB_OFFLOAD xdr Olga Kornievskaia
2018-02-20 16:42 ` [PATCH v7 02/10] NFSD OFFLOAD_STATUS xdr Olga Kornievskaia
2018-02-20 16:42 ` [PATCH v7 03/10] NFSD OFFLOAD_CANCEL xdr Olga Kornievskaia
2018-02-20 16:42 ` [PATCH v7 04/10] NFSD xdr callback stateid in async COPY reply Olga Kornievskaia
2018-02-20 16:42 ` [PATCH v7 05/10] NFSD introduce asynch copy feature Olga Kornievskaia
2018-03-06 21:27   ` J. Bruce Fields
2018-03-07 20:48     ` Olga Kornievskaia
2018-03-07 20:38   ` J. Bruce Fields
2018-03-07 20:50     ` Olga Kornievskaia
2018-03-07 21:05   ` J. Bruce Fields
2018-03-07 22:06     ` Olga Kornievskaia
2018-03-08 15:07       ` J. Bruce Fields
2018-03-22 15:08     ` Olga Kornievskaia
2018-02-20 16:42 ` [PATCH v7 06/10] NFSD return nfs4_stid in nfs4_preprocess_stateid_op Olga Kornievskaia
2018-03-07 21:43   ` J. Bruce Fields
2018-03-07 21:54     ` Olga Kornievskaia
2018-03-08 15:14       ` J. Bruce Fields
2018-02-20 16:42 ` [PATCH v7 07/10] NFSD create new stateid for async copy Olga Kornievskaia
2018-03-08 16:31   ` J. Bruce Fields
2018-03-22 15:12     ` Olga Kornievskaia
2018-03-22 15:17       ` J. Bruce Fields
2018-03-22 16:40         ` Olga Kornievskaia
2018-02-20 16:42 ` [PATCH v7 08/10] NFSD handle OFFLOAD_CANCEL op Olga Kornievskaia
2018-02-20 16:42 ` [PATCH v7 09/10] NFSD support OFFLOAD_STATUS Olga Kornievskaia
2018-02-20 16:42 ` [PATCH v7 10/10] NFSD stop queued async copies on client shutdown Olga Kornievskaia
2018-03-08 17:05   ` J. Bruce Fields
2018-04-10 20:09     ` Olga Kornievskaia
2018-04-10 20:21       ` J. Bruce Fields
2018-04-10 21:07         ` Olga Kornievskaia
2018-04-10 21:13           ` J. Bruce Fields
2018-04-11 17:33             ` J. Bruce Fields
2018-04-12 20:05               ` Olga Kornievskaia
2018-04-12 20:06                 ` J. Bruce Fields [this message]

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=20180412200636.GB29609@parsley.fieldses.org \
    --to=bfields@redhat.com \
    --cc=aglo@umich.edu \
    --cc=bfields@fieldses.org \
    --cc=kolga@netapp.com \
    --cc=linux-nfs@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.