linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bruce Fields <bfields@fieldses.org>
To: Trond Myklebust <trond.myklebust@primarydata.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 11/70] NFSd: Ensure delegation setup is safe w.r.t. break_lease()
Date: Tue, 6 May 2014 19:41:36 -0400	[thread overview]
Message-ID: <20140506234136.GU18281@fieldses.org> (raw)
In-Reply-To: <1397846704-14567-12-git-send-email-trond.myklebust@primarydata.com>

On Fri, Apr 18, 2014 at 02:44:05PM -0400, Trond Myklebust wrote:
> Ensure that we add/remove the dl_perfile under the inode->i_lock

Looks like maybe this addresses my question on the previous patch--in
which case it should really be merged with the previous patch for
bisectability?

--b.

> 
> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
> ---
>  fs/nfsd/nfs4state.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 85fcbc9ebd40..3656980b5d19 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -441,7 +441,9 @@ static void
>  hash_delegation_locked(struct nfs4_delegation *dp, struct nfs4_file *fp)
>  {
>  	dp->dl_stid.sc_type = NFS4_DELEG_STID;
> +	spin_lock(&fp->fi_inode->i_lock);
>  	list_add(&dp->dl_perfile, &fp->fi_delegations);
> +	spin_unlock(&fp->fi_inode->i_lock);
>  	list_add(&dp->dl_perclnt, &dp->dl_stid.sc_client->cl_delegations);
>  }
>  
> @@ -449,13 +451,19 @@ hash_delegation_locked(struct nfs4_delegation *dp, struct nfs4_file *fp)
>  static void
>  unhash_delegation(struct nfs4_delegation *dp)
>  {
> +	struct nfs4_file *fp = dp->dl_file;
> +
>  	spin_lock(&state_lock);
>  	list_del_init(&dp->dl_perclnt);
> -	list_del_init(&dp->dl_perfile);
>  	list_del_init(&dp->dl_recall_lru);
> +	if (!list_empty(&dp->dl_perfile)) {
> +		spin_lock(&fp->fi_inode->i_lock);
> +		list_del_init(&dp->dl_perfile);
> +		spin_unlock(&fp->fi_inode->i_lock);
> +	}
>  	spin_unlock(&state_lock);
> -	nfs4_put_deleg_lease(dp->dl_file);
> -	put_nfs4_file(dp->dl_file);
> +	nfs4_put_deleg_lease(fp);
> +	put_nfs4_file(fp);
>  	dp->dl_file = NULL;
>  }
>  
> -- 
> 1.9.0
> 

  parent reply	other threads:[~2014-05-06 23:41 UTC|newest]

Thread overview: 118+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-18 18:43 [PATCH 00/70] NFSd lock scalability patches Trond Myklebust
2014-04-18 18:43 ` [PATCH 01/70] NFSd: Ensure we clear the cstate->slot in nfsd4_proc_compound Trond Myklebust
2014-04-18 18:43   ` [PATCH 02/70] NFSd: Move default initialisers from create_client() to alloc_client() Trond Myklebust
2014-04-18 18:43     ` [PATCH 03/70] NFSd: call rpc_destroy_wait_queue() from free_client() Trond Myklebust
2014-04-18 18:43       ` [PATCH 04/70] NFSd: Remove 'inline' designation for free_client() Trond Myklebust
2014-04-18 18:43         ` [PATCH 05/70] nfsd4: rename recall_lock to state_lock Trond Myklebust
2014-04-18 18:44           ` [PATCH 06/70] nfsd4: use cl_lock to synchronize all stateid idr calls Trond Myklebust
2014-04-18 18:44             ` [PATCH 07/70] nfsd4: hash deleg stateid only on successful nfs4_set_delegation Trond Myklebust
2014-04-18 18:44               ` [PATCH 08/70] nfsd4: use state_lock for delegation hashing Trond Myklebust
2014-04-18 18:44                 ` [PATCH 09/70] NFSd: Mark nfs4_free_lockowner and nfs4_free_openowner as static functions Trond Myklebust
2014-04-18 18:44                   ` [PATCH 10/70] NFSd: Avoid taking state_lock while holding inode lock in nfsd_break_one_deleg Trond Myklebust
2014-04-18 18:44                     ` [PATCH 11/70] NFSd: Ensure delegation setup is safe w.r.t. break_lease() Trond Myklebust
2014-04-18 18:44                       ` [PATCH 12/70] NFSd: Add fine grained protection for the nfs4_file->fi_stateids list Trond Myklebust
2014-04-18 18:44                         ` [PATCH 13/70] NFSd: Clean up nfs4_preprocess_stateid_op Trond Myklebust
2014-04-18 18:44                           ` [PATCH 14/70] NFSd: Add a mutex to protect the NFSv4.0 open owner replay cache Trond Myklebust
2014-04-18 18:44                             ` [PATCH 15/70] NFSd: Add locking to the nfs4_file->fi_fds[] array Trond Myklebust
2014-04-18 18:44                               ` [PATCH 16/70] NFSd: Protect the nfs4_file delegation fields using the fi_lock Trond Myklebust
2014-04-18 18:44                                 ` [PATCH 17/70] NFSd: Lock owners are not per open stateid Trond Myklebust
2014-04-18 18:44                                   ` [PATCH 18/70] NFSd: Clean up helper __release_lock_stateid Trond Myklebust
2014-04-18 18:44                                     ` [PATCH 19/70] NFSd: Allow lockowners to hold several stateids Trond Myklebust
2014-04-18 18:44                                       ` [PATCH 20/70] NFSd: NFSv4 lock-owners are not associated to a specific file Trond Myklebust
2014-04-18 18:44                                         ` [PATCH 21/70] NFSd: Get rid of the lockowner_ino_hashtbl Trond Myklebust
2014-04-18 18:44                                           ` [PATCH 22/70] NFSd: Cleanup nfs4svc_encode_compoundres Trond Myklebust
2014-04-18 18:44                                             ` [PATCH 23/70] NFSd: Don't get a session reference without a client reference Trond Myklebust
2014-04-18 18:44                                               ` [PATCH 24/70] NFSd: Move the delegation reference counter into the struct nfs4_stid Trond Myklebust
2014-04-18 18:44                                                 ` [PATCH 25/70] NFSd: Simplify stateid management Trond Myklebust
2014-04-18 18:44                                                   ` [PATCH 26/70] NFSd: Fix delegation revocation Trond Myklebust
2014-04-18 18:44                                                     ` [PATCH 27/70] NFSd: Don't let the laundromat reap clients that are referenced Trond Myklebust
2014-04-18 18:44                                                       ` [PATCH 28/70] NFSd: Add reference counting to the lock and open stateids Trond Myklebust
2014-04-18 18:44                                                         ` [PATCH 29/70] NFSd: Add a struct nfs4_file field to struct nfs4_stid Trond Myklebust
2014-04-18 18:44                                                           ` [PATCH 30/70] NFSd: Replace delegation->dl_file with the dl_stid.sc_file Trond Myklebust
2014-04-18 18:44                                                             ` [PATCH 31/70] NFSd: Replace nfs4_ol_stateid->st_file with the st_stid.sc_file Trond Myklebust
2014-04-18 18:44                                                               ` [PATCH 32/70] NFSd: Ensure stateids remain unique until they are freed Trond Myklebust
2014-04-18 18:44                                                                 ` [PATCH 33/70] NFSd: Ensure atomicity of stateid destruction and idr tree removal Trond Myklebust
2014-04-18 18:44                                                                   ` [PATCH 34/70] NFSd: Fix atomicity of delegation counter Trond Myklebust
2014-04-18 18:44                                                                     ` [PATCH 35/70] NFSd: Slight cleanup of find_stateid() Trond Myklebust
2014-04-18 18:44                                                                       ` [PATCH 36/70] NFSd: Add reference counting to find_stateid Trond Myklebust
2014-04-18 18:44                                                                         ` [PATCH 37/70] NFSd: nfs4_preprocess_seqid_op should only set *stpp on success Trond Myklebust
2014-04-18 18:44                                                                           ` [PATCH 38/70] NFSd: Add reference counting to lock stateids Trond Myklebust
2014-04-18 18:44                                                                             ` [PATCH 39/70] NFSd: nfsd4_locku() must reference the lock stateid Trond Myklebust
2014-04-18 18:44                                                                               ` [PATCH 40/70] NFSd: Ensure that nfs4_open_delegation() references the delegation stateid Trond Myklebust
2014-04-18 18:44                                                                                 ` [PATCH 41/70] NFSd: nfsd4_process_open2() must reference " Trond Myklebust
2014-04-18 18:44                                                                                   ` [PATCH 42/70] NFSd: nfsd4_process_open2() must reference the open stateid Trond Myklebust
2014-04-18 18:44                                                                                     ` [PATCH 43/70] NFSd: Prepare nfsd4_close() for open stateid referencing Trond Myklebust
2014-04-18 18:44                                                                                       ` [PATCH 44/70] NFSd: nfsd4_open_confirm() must reference the open stateid Trond Myklebust
2014-04-18 18:44                                                                                         ` [PATCH 45/70] NFSd: Add reference counting to nfs4_preprocess_confirmed_seqid_op Trond Myklebust
2014-04-18 18:44                                                                                           ` [PATCH 46/70] NFSd: Migrate the stateid reference into nfs4_preprocess_seqid_op Trond Myklebust
2014-04-18 18:44                                                                                             ` [PATCH 47/70] NFSd: Migrate the stateid reference into nfs4_lookup_stateid() Trond Myklebust
2014-04-18 18:44                                                                                               ` [PATCH 48/70] NFSd: Migrate the stateid reference into nfs4_find_stateid_by_type() Trond Myklebust
2014-04-18 18:44                                                                                                 ` [PATCH 49/70] NFSd: Cleanup - Let nfsd4_lookup_stateid() take a cstate argument Trond Myklebust
2014-04-18 18:44                                                                                                   ` [PATCH 50/70] NFSd: Use the session->se_client in lookup_clientid() Trond Myklebust
2014-04-18 18:44                                                                                                     ` [PATCH 51/70] NFSd: Convert nfsd4_process_open1() to work with lookup_clientid() Trond Myklebust
2014-04-18 18:44                                                                                                       ` [PATCH 52/70] NFSd: Convert nfs4_check_open_reclaim() " Trond Myklebust
2014-04-18 18:44                                                                                                         ` [PATCH 53/70] NFSd: Ensure struct nfs4_client is unhashed before we try to destroy it Trond Myklebust
2014-04-18 18:44                                                                                                           ` [PATCH 54/70] NFSd: Ensure that the laundromat unhashes the client before releasing locks Trond Myklebust
2014-04-18 18:44                                                                                                             ` [PATCH 55/70] NFSd: Don't require client_lock in free_client Trond Myklebust
2014-04-18 18:44                                                                                                               ` [PATCH 56/70] NFSd: Move create_client() call outside the lock Trond Myklebust
2014-04-18 18:44                                                                                                                 ` [PATCH 57/70] NFSd: Protect unconfirmed client creation using client_lock Trond Myklebust
2014-04-18 18:44                                                                                                                   ` [PATCH 58/70] NFSd: Protect session creation and client confirm " Trond Myklebust
2014-04-18 18:44                                                                                                                     ` [PATCH 59/70] NFSd: Protect nfsd4_destroy_clientid " Trond Myklebust
2014-04-18 18:44                                                                                                                       ` [PATCH 60/70] NFSd: Ensure lookup_clientid() takes client_lock Trond Myklebust
2014-04-18 18:44                                                                                                                         ` [PATCH 61/70] NFSd: Remove nfs4_lock_state(): nfs4_preprocess_stateid_op() Trond Myklebust
2014-04-18 18:44                                                                                                                           ` [PATCH 62/70] NFSd: Remove nfs4_lock_state(): nfsd4_test_stateid/nfsd4_free_stateid Trond Myklebust
2014-04-18 18:44                                                                                                                             ` [PATCH 63/70] NFSd: Remove nfs4_lock_state(): nfsd4_release_lockowner Trond Myklebust
2014-04-18 18:44                                                                                                                               ` [PATCH 64/70] NFSd: Remove nfs4_lock_state(): nfsd4_lock/locku/lockt() Trond Myklebust
2014-04-18 18:44                                                                                                                                 ` [PATCH 65/70] NFSd: Remove nfs4_lock_state(): nfsd4_open_downgrade + nfsd4_close Trond Myklebust
2014-04-18 18:45                                                                                                                                   ` [PATCH 66/70] NFSd: Remove nfs4_lock_state(): nfsd4_delegreturn() Trond Myklebust
2014-04-18 18:45                                                                                                                                     ` [PATCH 67/70] NFSd: Remove nfs4_lock_state(): nfsd4_open and nfsd4_open_confirm Trond Myklebust
2014-04-18 18:45                                                                                                                                       ` [PATCH 68/70] NFSd: Remove nfs4_lock_state(): exchange_id, create/destroy_session() Trond Myklebust
2014-04-18 18:45                                                                                                                                         ` [PATCH 69/70] NFSd: Remove nfs4_lock_state(): setclientid, setclientid_confirm, renew Trond Myklebust
2014-04-18 18:45                                                                                                                                           ` [PATCH 70/70] NFSd: Remove nfs4_lock_state(): reclaim_complete() Trond Myklebust
2014-05-05  8:53                                                                                                                         ` [PATCH 60/70] NFSd: Ensure lookup_clientid() takes client_lock Christoph Hellwig
2014-05-16 18:19                                                                                                                     ` [PATCH 58/70] NFSd: Protect session creation and client confirm using client_lock Jeff Layton
2014-04-19 14:56                                                                                                     ` [PATCH 50/70] NFSd: Use the session->se_client in lookup_clientid() Christoph Hellwig
2014-05-07 20:18                                                                                                     ` Bruce Fields
2014-05-07 20:21                                                                                                       ` Bruce Fields
2014-05-07 19:58                                                                           ` [PATCH 37/70] NFSd: nfs4_preprocess_seqid_op should only set *stpp on success Bruce Fields
2014-05-08 19:48                                                                             ` Trond Myklebust
2014-04-19 14:50                                                                         ` [PATCH 36/70] NFSd: Add reference counting to find_stateid Christoph Hellwig
2014-04-21 15:37                                                                           ` Trond Myklebust
2014-04-19 14:41                                                                       ` [PATCH 35/70] NFSd: Slight cleanup of find_stateid() Christoph Hellwig
2014-04-21 13:31                                                                         ` Trond Myklebust
2014-04-19 15:51                                                                     ` [PATCH 34/70] NFSd: Fix atomicity of delegation counter Christoph Hellwig
2014-04-21 15:58                                                                       ` Trond Myklebust
2014-04-19 14:40                                                             ` [PATCH 30/70] NFSd: Replace delegation->dl_file with the dl_stid.sc_file Christoph Hellwig
2014-04-21 13:13                                                               ` Trond Myklebust
2014-05-05  9:01                                                             ` Christoph Hellwig
2014-05-07 19:25                                                           ` [PATCH 29/70] NFSd: Add a struct nfs4_file field to struct nfs4_stid Bruce Fields
2014-05-08 19:40                                                             ` Trond Myklebust
2014-05-09  7:34                                                               ` Christoph Hellwig
2014-05-07 19:20                                                       ` [PATCH 27/70] NFSd: Don't let the laundromat reap clients that are referenced Bruce Fields
2014-05-07 18:46                                                     ` [PATCH 26/70] NFSd: Fix delegation revocation Bruce Fields
2014-05-07 16:21                                                   ` [PATCH 25/70] NFSd: Simplify stateid management Bruce Fields
2014-04-19 14:38                                           ` [PATCH 21/70] NFSd: Get rid of the lockowner_ino_hashtbl Christoph Hellwig
2014-04-21 13:08                                             ` Trond Myklebust
2014-05-07 15:20                                       ` [PATCH 19/70] NFSd: Allow lockowners to hold several stateids Bruce Fields
2014-05-22 12:20                                         ` Jeff Layton
2014-04-19 14:35                               ` [PATCH 15/70] NFSd: Add locking to the nfs4_file->fi_fds[] array Christoph Hellwig
2014-04-21 13:01                                 ` Trond Myklebust
2014-04-21 13:14                                   ` Christoph Hellwig
2014-04-21 13:16                                     ` Christoph Hellwig
2014-05-06 23:41                       ` Bruce Fields [this message]
2014-05-09  0:56                         ` [PATCH 11/70] NFSd: Ensure delegation setup is safe w.r.t. break_lease() Trond Myklebust
2014-05-06 23:40                     ` [PATCH 10/70] NFSd: Avoid taking state_lock while holding inode lock in nfsd_break_one_deleg Bruce Fields
2014-05-09  0:50                       ` Trond Myklebust
2014-05-30 12:05                         ` Jeff Layton
2014-04-19 15:56                 ` [PATCH 08/70] nfsd4: use state_lock for delegation hashing Christoph Hellwig
2014-05-06 16:48             ` [PATCH 06/70] nfsd4: use cl_lock to synchronize all stateid idr calls Bruce Fields
2014-05-06 16:40         ` [PATCH 04/70] NFSd: Remove 'inline' designation for free_client() Bruce Fields
2014-05-06 16:37       ` [PATCH 03/70] NFSd: call rpc_destroy_wait_queue() from free_client() Bruce Fields
2014-05-06 16:37     ` [PATCH 02/70] NFSd: Move default initialisers from create_client() to alloc_client() Bruce Fields
2014-05-06 15:32   ` [PATCH 01/70] NFSd: Ensure we clear the cstate->slot in nfsd4_proc_compound Bruce Fields
2014-05-06 16:36     ` Bruce Fields
2014-04-19 15:04 ` [PATCH 00/70] NFSd lock scalability patches Christoph Hellwig
2014-04-19 20:58 ` Bruce Fields
2014-05-07 20:29   ` Bruce Fields
2014-05-08 20:16     ` Trond Myklebust
2014-04-21 15:01 ` Christoph Hellwig

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=20140506234136.GU18281@fieldses.org \
    --to=bfields@fieldses.org \
    --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;
as well as URLs for NNTP newsgroup(s).