linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sachin Prabhu <sprabhu@redhat.com>
To: Trond Myklebust <Trond.Myklebust@netapp.com>
Cc: linux-nfs <linux-nfs@vger.kernel.org>
Subject: Re: NFS4 clients cannot reclaim locks
Date: Wed, 6 Oct 2010 11:59:20 -0400 (EDT)	[thread overview]
Message-ID: <26335422.12.1286380757582.JavaMail.sprabhu@dhcp-1-233.fab.redhat.com> (raw)
In-Reply-To: <1286285838.3338.1.camel@heimdal.trondhjem.org>


----- "Trond Myklebust" <Trond.Myklebust@netapp.com> wrote:

> Yup. That makes sense. Does the following patch help?
> 
> Cheers
>   Trond
> --------------------------------------------------------------------------------------------------------
> NFSv4: Fix open recovery
> 
> From: Trond Myklebust <Trond.Myklebust@netapp.com>
> 
> NFSv4 open recovery is currently broken: since we do not clear the
> state->flags states before attempting recovery, we end up with the
> 'can_open_cached()' function triggering. This again leads to no OPEN
> call
> being put on the wire.
> 
> Reported-by: Sachin Prabhu <sprabhu@redhat.com>
> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
> ---
> 
>  fs/nfs/nfs4proc.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> 
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> index 089da5b..01b4817 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -1120,6 +1120,7 @@ static int nfs4_open_recover(struct
> nfs4_opendata *opendata, struct nfs4_state *
>  	clear_bit(NFS_DELEGATED_STATE, &state->flags);
>  	smp_rmb();
>  	if (state->n_rdwr != 0) {
> +		clear_bit(NFS_O_RDWR_STATE, &state->flags);
>  		ret = nfs4_open_recover_helper(opendata, FMODE_READ|FMODE_WRITE,
> &newstate);
>  		if (ret != 0)
>  			return ret;
> @@ -1127,6 +1128,7 @@ static int nfs4_open_recover(struct
> nfs4_opendata *opendata, struct nfs4_state *
>  			return -ESTALE;
>  	}
>  	if (state->n_wronly != 0) {
> +		clear_bit(NFS_O_WRONLY_STATE, &state->flags);
>  		ret = nfs4_open_recover_helper(opendata, FMODE_WRITE, &newstate);
>  		if (ret != 0)
>  			return ret;
> @@ -1134,6 +1136,7 @@ static int nfs4_open_recover(struct
> nfs4_opendata *opendata, struct nfs4_state *
>  			return -ESTALE;
>  	}
>  	if (state->n_rdonly != 0) {
> +		clear_bit(NFS_O_RDONLY_STATE, &state->flags);
>  		ret = nfs4_open_recover_helper(opendata, FMODE_READ, &newstate);
>  		if (ret != 0)
>  			return ret;
> 


Yes. The patch works. 

As expected, repeated open calls are made with claim-type set to NULL. For each of these calls, a NFS4ERR_GRACE is returned by the server as long as it is in Grace period. Once the grace period has completed, the open call succeeds, a new stateid is set and the write operation continues.

Thank You
Sachin Prabhu

  reply	other threads:[~2010-10-06 15:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <18163799.104.1286186355944.JavaMail.sprabhu@dhcp-1-233.fab.redhat.com>
2010-10-04 10:03 ` NFS4 clients cannot reclaim locks Sachin Prabhu
2010-10-05 13:37   ` Trond Myklebust
2010-10-06 15:59     ` Sachin Prabhu [this message]
2010-10-05 13:38   ` Trond Myklebust
     [not found] <18697573.14.1286380841649.JavaMail.sprabhu@dhcp-1-233.fab.redhat.com>
2010-10-06 16:01 ` Sachin Prabhu
     [not found] <8181361.84.1285932468389.JavaMail.sprabhu@dhcp-1-233.fab.redhat.com>
2010-10-01 11:30 ` Sachin Prabhu
2010-10-01 20:46   ` Trond Myklebust
2010-10-05 15:03   ` Timo Aaltonen
2010-11-22 16:02     ` Timo Aaltonen

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=26335422.12.1286380757582.JavaMail.sprabhu@dhcp-1-233.fab.redhat.com \
    --to=sprabhu@redhat.com \
    --cc=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;
as well as URLs for NNTP newsgroup(s).