[pnfs] [PATCH 05/16] nfs41: limit the number of new session retrys

J. Bruce Fields bfields at fieldses.org
Wed Jul 16 13:15:19 EDT 2008


On Wed, Jul 16, 2008 at 12:29:54PM +0300, Benny Halevy wrote:
> From: Andy Adamson <andros at netapp.com>
> 
> Signed-off-by: Andy Adamson<andros at netapp.com>
> Signed-off-by: Benny Halevy <bhalevy at panasas.com>
> ---
>  fs/nfs/nfs4_fs.h                       |    3 +++
>  fs/nfs/nfs4proc.c                      |    3 +++
>  include/linux/nfs41_session_recovery.h |    3 +++
>  3 files changed, 9 insertions(+), 0 deletions(-)
> 
> diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
> index 81a418d..065de35 100644
> --- a/fs/nfs/nfs4_fs.h
> +++ b/fs/nfs/nfs4_fs.h
> @@ -157,6 +157,9 @@ struct nfs4_state {
>  struct nfs4_exception {
>  	long timeout;
>  	int retry;
> +#ifdef CONFIG_NFS_V4_1
> +	int num_tries;
> +#endif /* CONFIG_NFS_V4_1 */
>  };
>  
>  struct nfs4_state_recovery_ops {
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> index 0e18ed5..4db0b13 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -3370,8 +3370,11 @@ static int nfs4_handle_exception(struct nfs_server *server, int errorcode, struc
>  		case -NFS4ERR_RETRY_UNCACHED_REP:
>  		case -NFS4ERR_TOO_MANY_OPS:
>  		case -NFS4ERR_OP_NOT_IN_SESSION:
> +			if (exception->num_tries  > NFS41_MAX_SESSION_RECOVER)
> +				break;

Out of curiosity--in one situations can you get into this loop?

--b.

>  			ret = nfs41_new_session(server);
>  			if (!ret) {
> +				exception->num_tries++;
>  				exception->retry = 1;
>  				break;
>  			}
> diff --git a/include/linux/nfs41_session_recovery.h b/include/linux/nfs41_session_recovery.h
> index 773dab7..d58db55 100644
> --- a/include/linux/nfs41_session_recovery.h
> +++ b/include/linux/nfs41_session_recovery.h
> @@ -11,6 +11,9 @@
>  
>  #if defined(CONFIG_NFS_V4_1)
>  
> +/* How many new sessions do we try upon error? */
> +#define NFS41_MAX_SESSION_RECOVER		4
> +
>  /*
>   * Session state bits
>   */
> -- 
> 1.5.6.3
> 
> _______________________________________________
> pNFS mailing list
> pNFS at linux-nfs.org
> http://linux-nfs.org/cgi-bin/mailman/listinfo/pnfs


More information about the pNFS mailing list