public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Trond Myklebust <Trond.Myklebust@netapp.com>
To: linux-nfs@vger.kernel.org
Subject: Re: [PATCH] NFSv4.1: Various fixes to the sequence flag error handling
Date: Sat, 20 Feb 2010 18:30:54 -0800	[thread overview]
Message-ID: <1266719454.3507.6.camel@localhost.localdomain> (raw)
In-Reply-To: <1266719139.3507.5.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>

On Sat, 2010-02-20 at 18:25 -0800, Trond Myklebust wrote: 
> From: Trond Myklebust <Trond.Myklebust@netapp.com>
> 
> Ensure that we change the EXCHANGE_ID verifier (i.e. clp->cl_boot_time)
> when we want to reset all state. This is mainly needed when the server
> tells us that it is revoking our open or lock stateids.
> 
> Handle revoking of recallable state by expiring the delegations.
> 
> Handle callback path issues by expiring the delegations and then resetting
> the session.
> 
> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
> ---
> 
>  fs/nfs/nfs4state.c |   57 +++++++++++++++++++++++++++++++++++++++++-----------
>  1 files changed, 45 insertions(+), 12 deletions(-)
> 
> 
> diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
> index c1e2733..97a3b60 100644
> --- a/fs/nfs/nfs4state.c
> +++ b/fs/nfs/nfs4state.c
> @@ -1249,26 +1249,59 @@ static int nfs4_reclaim_lease(struct nfs_client *clp)
>  }
>  
>  #ifdef CONFIG_NFS_V4_1
> +static void nfs4_reset_all_state(struct nfs_client *clp)
> +{
> +	if (test_and_set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) {

Doh!!! Should be 'if (!test_and_set_bit())....

Will resend.

> +		clp->cl_boot_time = CURRENT_TIME;
> +		nfs4_state_start_reclaim_nograce(clp);
> +		nfs4_schedule_state_recovery(clp);
> +	}
> +}
> +
> +static void nfs41_handle_server_reboot(struct nfs_client *clp)
> +{
> +	if (test_and_set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state)) {

Ditto

> +		nfs4_state_start_reclaim_reboot(clp);
> +		nfs4_schedule_state_recovery(clp);
> +	}
> +}
> +
> +static void nfs41_handle_state_revoked(struct nfs_client *clp)
> +{
> +	/* Temporary */
> +	nfs4_reset_all_state(clp);
> +}
> +
> +static void nfs41_handle_recallable_state_revoked(struct nfs_client *clp)
> +{
> +	/* This will need to handle layouts too */
> +	nfs_expire_all_delegations(clp);
> +}
> +
> +static void nfs41_handle_cb_path_down(struct nfs_client *clp)
> +{
> +	nfs_expire_all_delegations(clp);
> +	if (test_and_set_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state))

Ditto

> +		nfs4_schedule_state_recovery(clp);
> +}
> +
>  void nfs41_handle_sequence_flag_errors(struct nfs_client *clp, u32 flags)
>  {
>  	if (!flags)
>  		return;
> -	else if (flags & SEQ4_STATUS_RESTART_RECLAIM_NEEDED) {
> -		set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
> -		nfs4_state_start_reclaim_reboot(clp);
> -		nfs4_schedule_state_recovery(clp);
> -	} else if (flags & (SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED |
> +	else if (flags & SEQ4_STATUS_RESTART_RECLAIM_NEEDED)
> +		nfs41_handle_server_reboot(clp);
> +	else if (flags & (SEQ4_STATUS_EXPIRED_ALL_STATE_REVOKED |
>  			    SEQ4_STATUS_EXPIRED_SOME_STATE_REVOKED |
>  			    SEQ4_STATUS_ADMIN_STATE_REVOKED |
> -			    SEQ4_STATUS_RECALLABLE_STATE_REVOKED |
> -			    SEQ4_STATUS_LEASE_MOVED)) {
> -		set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state);
> -		nfs4_state_start_reclaim_nograce(clp);
> -		nfs4_schedule_state_recovery(clp);
> -	} else if (flags & (SEQ4_STATUS_CB_PATH_DOWN |
> +			    SEQ4_STATUS_LEASE_MOVED))
> +		nfs41_handle_state_revoked(clp);
> +	else if (flags & SEQ4_STATUS_RECALLABLE_STATE_REVOKED)
> +		nfs41_handle_recallable_state_revoked(clp);
> +	else if (flags & (SEQ4_STATUS_CB_PATH_DOWN |
>  			    SEQ4_STATUS_BACKCHANNEL_FAULT |
>  			    SEQ4_STATUS_CB_PATH_DOWN_SESSION))
> -		nfs_expire_all_delegations(clp);
> +		nfs41_handle_cb_path_down(clp);
>  }
>  
>  static int nfs4_reset_session(struct nfs_client *clp)
> 
> --
> 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:[~2010-02-21  2:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-21  2:25 [PATCH] NFSv4.1: Various fixes to the sequence flag error handling Trond Myklebust
     [not found] ` <1266719139.3507.5.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-02-21  2:30   ` Trond Myklebust [this message]
2010-02-21  2:34     ` [PATCH v2] " 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=1266719454.3507.6.camel@localhost.localdomain \
    --to=trond.myklebust@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox