[pnfs] [PATCH 11/11] nfs41: state reclaimer renew lease error handling

Benny Halevy bhalevy at panasas.com
Sun Jul 13 07:40:18 EDT 2008


On Jul. 11, 2008, 17:39 +0300, andros at netapp.com wrote:
> From: Andy Adamson <andros at netapp.com>
> 
> The state reclaimer has been called due to a NFS4_STALE_CLIENTID or NFS4_EXPIRE
> error. First it tries to renew the old lease (network partion case) which for
> v4.1 means an nfs4_proc_sequence call. Any error from the sequence operation
> means that the lease cannot be renewed.
> 
> Switch on the minorversion to handle the error return from the renew lease call.
> 
> Signed-off-by: Andy Adamson<andros at netapp.com>
> ---
>  fs/nfs/nfs4state.c |   22 ++++++++++++++++------
>  1 files changed, 16 insertions(+), 6 deletions(-)
> 
> diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
> index 739e81e..fd30409 100644
> --- a/fs/nfs/nfs4state.c
> +++ b/fs/nfs/nfs4state.c
> @@ -992,13 +992,23 @@ restart_loop:
>  		/* Yes there are: try to renew the old lease */
>  		status = ops->renew_lease(clp, cred);
>  		put_rpccred(cred);
> -		switch (status) {
> +		switch (clp->cl_minorversion) {
>  		case 0:
> -		case -NFS4ERR_CB_PATH_DOWN:
> -			goto out;
> -		case -NFS4ERR_STALE_CLIENTID:
> -		case -NFS4ERR_LEASE_MOVED:
> -			ops = nfs4_reboot_recovery_ops[clp->cl_minorversion];
> +			switch (status) {
> +			case 0:
> +			case -NFS4ERR_CB_PATH_DOWN:
> +				goto out;
> +			case -NFS4ERR_STALE_CLIENTID:
> +			case -NFS4ERR_LEASE_MOVED:
> +				ops = nfs4_reboot_recovery_ops[0];
> +			}
> +		case 1:
> +			switch (status) {
> +			case 0:
> +				goto out;
> +			default:
> +				ops = nfs4_reboot_recovery_ops[1];

Seems like it'd be more elegant to pull this out of the switch
statement as
	ops = nfs4_reboot_recovery_ops[clp->cl_minorversion];

and then the nested switch for the v4.1 case is reduces to
	if (!status)
		goto out;

Benny

> +			}
>  		}
>  	} else {
>  		/* "reboot" to ensure we clear all state on the server */



More information about the pNFS mailing list