All of lore.kernel.org
 help / color / mirror / Atom feed
From: Trond Myklebust <Trond.Myklebust@netapp.com>
To: Jim Rees <rees@umich.edu>
Cc: Benny Halevy <bhalevy@panasas.com>,
	linux-nfs@vger.kernel.org, peter honeyman <honey@citi.umich.edu>
Subject: Re: [PATCH] zero out delegation in the inode after it has been returned
Date: Mon, 28 Feb 2011 16:39:04 -0500	[thread overview]
Message-ID: <1298929144.8564.44.camel@heimdal.trondhjem.org> (raw)
In-Reply-To: <20110228213103.GA1256@merit.edu>

On Mon, 2011-02-28 at 16:31 -0500, Jim Rees wrote: 
> Signed-off-by: Jim Rees <rees@umich.edu>
> ---
>  fs/nfs/delegation.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
> index bbbc6bf..5bc4f7e 100644
> --- a/fs/nfs/delegation.c
> +++ b/fs/nfs/delegation.c
> @@ -176,9 +176,11 @@ void nfs_inode_reclaim_delegation(struct inode *inode, struct rpc_cred *cred,
>  
>  static int nfs_do_return_delegation(struct inode *inode, struct nfs_delegation *delegation, int issync)
>  {
> +	struct nfs_inode *nfsi = NFS_I(inode);
>  	int res = 0;
>  
>  	res = nfs4_proc_delegreturn(inode, delegation->cred, &delegation->stateid, issync);
> +	rcu_assign_pointer(nfsi->delegation, NULL);
>  	nfs_free_delegation(delegation);
>  	return res;
>  }

Big NACK...

nfsi->delegation is released under the appropriate locks well before we
get here. The above line is 100% racy and risks clobbering any new
delegation that has been issued after the delegreturn completed...

Trond
-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@netapp.com
www.netapp.com


  reply	other threads:[~2011-02-28 21:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-28 21:31 [PATCH] zero out delegation in the inode after it has been returned Jim Rees
2011-02-28 21:39 ` Trond Myklebust [this message]
2011-02-28 21:54   ` Jim Rees
2011-02-28 22:01     ` Trond Myklebust
2011-02-28 22:04       ` Trond Myklebust
2011-02-28 23:22       ` Jim Rees
2011-03-01  0:00         ` Trond Myklebust
2011-03-01  0:07           ` Trond Myklebust
2011-03-01  4:09           ` J. Bruce Fields
2011-03-01  9:52             ` daniel.gardere
2011-03-01 12:16               ` Trond Myklebust
2011-03-01 13:06                 ` daniel.gardere

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=1298929144.8564.44.camel@heimdal.trondhjem.org \
    --to=trond.myklebust@netapp.com \
    --cc=bhalevy@panasas.com \
    --cc=honey@citi.umich.edu \
    --cc=linux-nfs@vger.kernel.org \
    --cc=rees@umich.edu \
    /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.