Linux NFS development
 help / color / mirror / Atom feed
From: bfields@fieldses.org (J. Bruce Fields)
To: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: Andrew Elble <aweits@rit.edu>,
	Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH RFC v3] nfs: nfs_do_return_delegation() needs to send FREE_STATEID
Date: Mon, 9 Nov 2015 13:03:20 -0500	[thread overview]
Message-ID: <20151109180320.GB8738@fieldses.org> (raw)
In-Reply-To: <CAHQdGtQmYV9Aq+=CivbmPTjHMZVhd8BznpMsmXXD=cZwzOO0Uw@mail.gmail.com>

On Thu, Nov 05, 2015 at 09:27:06AM -0500, Trond Myklebust wrote:
> Hi Andrew,
> 
> On Wed, Nov 4, 2015 at 7:43 PM, Andrew Elble <aweits@rit.edu> wrote:
> > In the NFS4.1 case, revoked delegations need to be processed via
> > FREE_STATEID, not simply forgotten.
> >
> > Fixes: 869f9dfa4d6d ("NFSv4: Fix races between nfs_remove_bad_delegation() and delegation return")
> > Signed-off-by: Andrew Elble <aweits@rit.edu>
> > ---
> >  fs/nfs/delegation.c |  6 ++++++
> >  fs/nfs/nfs4_fs.h    |  2 ++
> >  fs/nfs/nfs4proc.c   | 18 ++++++++++--------
> >  3 files changed, 18 insertions(+), 8 deletions(-)
> >
> > diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
> > index 5166adcfc0fb..dc971adb7af9 100644
> > --- a/fs/nfs/delegation.c
> > +++ b/fs/nfs/delegation.c
> > @@ -205,6 +205,12 @@ static int nfs_do_return_delegation(struct inode *inode, struct nfs_delegation *
> >                                 delegation->cred,
> >                                 &delegation->stateid,
> >                                 issync);
> > +#if defined(CONFIG_NFS_V4_1)
> > +       else if (NFS_SERVER(inode)->nfs_client->cl_minorversion)
> > +               res = nfs41_free_stateid(NFS_SERVER(inode),
> > +                                       &delegation->stateid,
> > +                                       delegation->cred, issync);
> > +#endif /* CONFIG_NFS_V4_1 */
> >         nfs_free_delegation(delegation);
> >         return res;
> 
> If the server is revoking a delegation, then presumably it will also
> set one or more of the SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED,
> SEQ4_STATUS_ADMIN_STATE_REVOKED, SEQ4_STATUS_RECALLABLE_STATE_REVOKED,
> which should start up a state manager thread to do the
> test_stateid/free_stateid dance.

The expiration could occur during the narrow window between the time the
server processes the SEQUENCE and the stateid-containing operation.
Though in that case there should be another SEQUENCE reply with the flag
set soon enough.

--b.

> 
> So instead of adding the free stateid call above, why can't we just
> punt the freeing of the delegation to the state manager?
> 
> Cheers
>   Trond
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-11-09 18:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-05  0:43 [PATCH RFC v3] nfs: nfs_do_return_delegation() needs to send FREE_STATEID Andrew Elble
2015-11-05 14:27 ` Trond Myklebust
2015-11-05 15:19   ` Andrew W Elble
2015-11-05 16:31     ` Trond Myklebust
2015-11-09 18:03   ` J. Bruce Fields [this message]
2015-11-09 18:32     ` Trond Myklebust

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=20151109180320.GB8738@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=aweits@rit.edu \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@primarydata.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