public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Anna Schumaker <Anna.Schumaker@netapp.com>
To: Trond Myklebust <trond.myklebust@primarydata.com>,
	<linux-nfs@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] NFSv4: fix open/lock state recovery error handling
Date: Wed, 1 Oct 2014 09:57:00 -0400	[thread overview]
Message-ID: <542C082C.3080602@Netapp.com> (raw)
In-Reply-To: <1411876498-12039-3-git-send-email-trond.myklebust@primarydata.com>

On 09/27/2014 11:54 PM, Trond Myklebust wrote:
> The current open/lock state recovery unfortunately does not handle errors
> such as NFS4ERR_CONN_NOT_BOUND_TO_SESSION correctly. Instead of looping,
> just proceeds as if the state manager is finished recovering.
> This patch ensures that we loop back, handle higher priority errors
> and complete the open/lock state recovery.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
> ---
>  fs/nfs/nfs4state.c | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
> index 26d510d11efd..87b2d0e79797 100644
> --- a/fs/nfs/nfs4state.c
> +++ b/fs/nfs/nfs4state.c
> @@ -1705,7 +1705,8 @@ restart:
>  			if (status < 0) {
>  				set_bit(ops->owner_flag_bit, &sp->so_flags);
>  				nfs4_put_state_owner(sp);
> -				return nfs4_recovery_handle_error(clp, status);
> +				status = nfs4_recovery_handle_error(clp, status);
> +				return (status != 0) ? status : -EAGAIN;

Why is the ternary better than doing something like this?

	if (status == 0)
		return -EAGAIN;
	return status;

Anna

>  			}
>  
>  			nfs4_put_state_owner(sp);
> @@ -1714,7 +1715,7 @@ restart:
>  		spin_unlock(&clp->cl_lock);
>  	}
>  	rcu_read_unlock();
> -	return status;
> +	return 0;
>  }
>  
>  static int nfs4_check_lease(struct nfs_client *clp)
> @@ -2365,14 +2366,11 @@ static void nfs4_state_manager(struct nfs_client *clp)
>  			section = "reclaim reboot";
>  			status = nfs4_do_reclaim(clp,
>  				clp->cl_mvops->reboot_recovery_ops);
> -			if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) ||
> -			    test_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state))
> -				continue;
> -			nfs4_state_end_reclaim_reboot(clp);
> -			if (test_bit(NFS4CLNT_RECLAIM_NOGRACE, &clp->cl_state))
> +			if (status == -EAGAIN)
>  				continue;
>  			if (status < 0)
>  				goto out_error;
> +			nfs4_state_end_reclaim_reboot(clp);
>  		}
>  
>  		/* Now recover expired state... */
> @@ -2380,9 +2378,7 @@ static void nfs4_state_manager(struct nfs_client *clp)
>  			section = "reclaim nograce";
>  			status = nfs4_do_reclaim(clp,
>  				clp->cl_mvops->nograce_recovery_ops);
> -			if (test_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state) ||
> -			    test_bit(NFS4CLNT_SESSION_RESET, &clp->cl_state) ||
> -			    test_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state))
> +			if (status == -EAGAIN)
>  				continue;
>  			if (status < 0)
>  				goto out_error;


  reply	other threads:[~2014-10-01 13:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-28  3:54 [PATCH v2 0/2] Fix NFS client state recovery Trond Myklebust
2014-09-28  3:54 ` [PATCH v2 1/2] NFSv4: Fix lock recovery when CREATE_SESSION/SETCLIENTID_CONFIRM fails Trond Myklebust
2014-09-28  3:54   ` [PATCH v2 2/2] NFSv4: fix open/lock state recovery error handling Trond Myklebust
2014-10-01 13:57     ` Anna Schumaker [this message]
2014-10-01 18:48       ` Trond Myklebust
2014-10-01 13:49   ` [PATCH v2 1/2] NFSv4: Fix lock recovery when CREATE_SESSION/SETCLIENTID_CONFIRM fails Anna Schumaker
2014-10-01 18:38     ` Trond Myklebust
2014-10-01 18:32   ` Jeff Layton
2014-10-01 18:46     ` Trond Myklebust
2014-10-01 18:54       ` Jeff Layton

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=542C082C.3080602@Netapp.com \
    --to=anna.schumaker@netapp.com \
    --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