linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nfsd4: in-stateid seqid should start with 1
@ 2011-08-31 19:53 J. Bruce Fields
  2011-08-31 20:27 ` Benny Halevy
  0 siblings, 1 reply; 6+ messages in thread
From: J. Bruce Fields @ 2011-08-31 19:53 UTC (permalink / raw)
  To: linux-nfs; +Cc: Casey Bodley

From: J. Bruce Fields <bfields@redhat.com>

Thanks to Casey for reminding me that 5661 gives a special meaning to a
value of 0 in the stateid's seqid field, so we should instead be
starting out stateid's with si_generation 1.

Reported-by: Casey Bodley <cbodley@citi.umich.edu>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
 fs/nfsd/nfs4state.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 49c3dd1..7caa812 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -251,7 +251,7 @@ alloc_init_deleg(struct nfs4_client *clp, struct nfs4_stateid *stp, struct svc_f
 	dp->dl_stateid.si_boot = boot_time;
 	dp->dl_stateid.si_stateownerid = current_delegid++;
 	dp->dl_stateid.si_fileid = 0;
-	dp->dl_stateid.si_generation = 0;
+	dp->dl_stateid.si_generation = 1;
 	fh_copy_shallow(&dp->dl_fh, &current_fh->fh_handle);
 	dp->dl_time = 0;
 	atomic_set(&dp->dl_count, 1);
@@ -2303,7 +2303,7 @@ init_stateid(struct nfs4_stateid *stp, struct nfs4_file *fp, struct nfsd4_open *
 	stp->st_stateid.si_boot = boot_time;
 	stp->st_stateid.si_stateownerid = oo->oo_owner.so_id;
 	stp->st_stateid.si_fileid = fp->fi_id;
-	stp->st_stateid.si_generation = 0;
+	stp->st_stateid.si_generation = 1;
 	stp->st_access_bmap = 0;
 	stp->st_deny_bmap = 0;
 	__set_bit(open->op_share_access & ~NFS4_SHARE_WANT_MASK,
@@ -3898,7 +3898,7 @@ alloc_init_lock_stateid(struct nfs4_lockowner *lo, struct nfs4_file *fp, struct
 	stp->st_stateid.si_boot = boot_time;
 	stp->st_stateid.si_stateownerid = lo->lo_owner.so_id;
 	stp->st_stateid.si_fileid = fp->fi_id;
-	stp->st_stateid.si_generation = 0;
+	stp->st_stateid.si_generation = 1;
 	stp->st_access_bmap = 0;
 	stp->st_deny_bmap = open_stp->st_deny_bmap;
 	stp->st_openstp = open_stp;
-- 
1.7.4.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] nfsd4: in-stateid seqid should start with 1
  2011-08-31 19:53 [PATCH] nfsd4: in-stateid seqid should start with 1 J. Bruce Fields
@ 2011-08-31 20:27 ` Benny Halevy
  2011-08-31 21:19   ` J. Bruce Fields
  0 siblings, 1 reply; 6+ messages in thread
From: Benny Halevy @ 2011-08-31 20:27 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: linux-nfs, Casey Bodley

Don't we also need the following?

As per RFC5661, skip zero seqid when wrapping around
while updating a stateid.

Signed-off-by: Benny Halevy <bhalevy@tonian.com>

git diff --stat -p -M
 fs/nfsd/state.h |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h
index 77f98b8..7d18d3e 100644
--- a/fs/nfsd/state.h
+++ b/fs/nfsd/state.h
@@ -289,7 +289,10 @@ struct nfs4_client_reclaim {
 static inline void
 update_stateid(stateid_t *stateid)
 {
-	stateid->si_generation++;
+	u32 new = stateid->si_generation + 1;
+	if (new == 0)
+		new = 1;
+	stateid->si_generation = new;
 }

 /* A reasonable value for REPLAY_ISIZE was estimated as follows:

On 2011-08-31 12:53, J. Bruce Fields wrote:
> From: J. Bruce Fields <bfields@redhat.com>
> 
> Thanks to Casey for reminding me that 5661 gives a special meaning to a
> value of 0 in the stateid's seqid field, so we should instead be
> starting out stateid's with si_generation 1.
> 
> Reported-by: Casey Bodley <cbodley@citi.umich.edu>
> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> ---
>  fs/nfsd/nfs4state.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 49c3dd1..7caa812 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -251,7 +251,7 @@ alloc_init_deleg(struct nfs4_client *clp, struct nfs4_stateid *stp, struct svc_f
>  	dp->dl_stateid.si_boot = boot_time;
>  	dp->dl_stateid.si_stateownerid = current_delegid++;
>  	dp->dl_stateid.si_fileid = 0;
> -	dp->dl_stateid.si_generation = 0;
> +	dp->dl_stateid.si_generation = 1;
>  	fh_copy_shallow(&dp->dl_fh, &current_fh->fh_handle);
>  	dp->dl_time = 0;
>  	atomic_set(&dp->dl_count, 1);
> @@ -2303,7 +2303,7 @@ init_stateid(struct nfs4_stateid *stp, struct nfs4_file *fp, struct nfsd4_open *
>  	stp->st_stateid.si_boot = boot_time;
>  	stp->st_stateid.si_stateownerid = oo->oo_owner.so_id;
>  	stp->st_stateid.si_fileid = fp->fi_id;
> -	stp->st_stateid.si_generation = 0;
> +	stp->st_stateid.si_generation = 1;
>  	stp->st_access_bmap = 0;
>  	stp->st_deny_bmap = 0;
>  	__set_bit(open->op_share_access & ~NFS4_SHARE_WANT_MASK,
> @@ -3898,7 +3898,7 @@ alloc_init_lock_stateid(struct nfs4_lockowner *lo, struct nfs4_file *fp, struct
>  	stp->st_stateid.si_boot = boot_time;
>  	stp->st_stateid.si_stateownerid = lo->lo_owner.so_id;
>  	stp->st_stateid.si_fileid = fp->fi_id;
> -	stp->st_stateid.si_generation = 0;
> +	stp->st_stateid.si_generation = 1;
>  	stp->st_access_bmap = 0;
>  	stp->st_deny_bmap = open_stp->st_deny_bmap;
>  	stp->st_openstp = open_stp;

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] nfsd4: in-stateid seqid should start with 1
  2011-08-31 20:27 ` Benny Halevy
@ 2011-08-31 21:19   ` J. Bruce Fields
  2011-08-31 21:29     ` Benny Halevy
  0 siblings, 1 reply; 6+ messages in thread
From: J. Bruce Fields @ 2011-08-31 21:19 UTC (permalink / raw)
  To: Benny Halevy; +Cc: linux-nfs, Casey Bodley

On Wed, Aug 31, 2011 at 01:27:58PM -0700, Benny Halevy wrote:
> Don't we also need the following?
> 
> As per RFC5661, skip zero seqid when wrapping around
> while updating a stateid.

Yep, done:

	http://marc.info/?l=linux-nfs&m=131439774426154&w=2

I need to send out my patches one at a time rather than fifteen at once
if I want people to read them....

--b.

> 
> Signed-off-by: Benny Halevy <bhalevy@tonian.com>
> 
> git diff --stat -p -M
>  fs/nfsd/state.h |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h
> index 77f98b8..7d18d3e 100644
> --- a/fs/nfsd/state.h
> +++ b/fs/nfsd/state.h
> @@ -289,7 +289,10 @@ struct nfs4_client_reclaim {
>  static inline void
>  update_stateid(stateid_t *stateid)
>  {
> -	stateid->si_generation++;
> +	u32 new = stateid->si_generation + 1;
> +	if (new == 0)
> +		new = 1;
> +	stateid->si_generation = new;
>  }
> 
>  /* A reasonable value for REPLAY_ISIZE was estimated as follows:
> 
> On 2011-08-31 12:53, J. Bruce Fields wrote:
> > From: J. Bruce Fields <bfields@redhat.com>
> > 
> > Thanks to Casey for reminding me that 5661 gives a special meaning to a
> > value of 0 in the stateid's seqid field, so we should instead be
> > starting out stateid's with si_generation 1.
> > 
> > Reported-by: Casey Bodley <cbodley@citi.umich.edu>
> > Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> > ---
> >  fs/nfsd/nfs4state.c |    6 +++---
> >  1 files changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> > index 49c3dd1..7caa812 100644
> > --- a/fs/nfsd/nfs4state.c
> > +++ b/fs/nfsd/nfs4state.c
> > @@ -251,7 +251,7 @@ alloc_init_deleg(struct nfs4_client *clp, struct nfs4_stateid *stp, struct svc_f
> >  	dp->dl_stateid.si_boot = boot_time;
> >  	dp->dl_stateid.si_stateownerid = current_delegid++;
> >  	dp->dl_stateid.si_fileid = 0;
> > -	dp->dl_stateid.si_generation = 0;
> > +	dp->dl_stateid.si_generation = 1;
> >  	fh_copy_shallow(&dp->dl_fh, &current_fh->fh_handle);
> >  	dp->dl_time = 0;
> >  	atomic_set(&dp->dl_count, 1);
> > @@ -2303,7 +2303,7 @@ init_stateid(struct nfs4_stateid *stp, struct nfs4_file *fp, struct nfsd4_open *
> >  	stp->st_stateid.si_boot = boot_time;
> >  	stp->st_stateid.si_stateownerid = oo->oo_owner.so_id;
> >  	stp->st_stateid.si_fileid = fp->fi_id;
> > -	stp->st_stateid.si_generation = 0;
> > +	stp->st_stateid.si_generation = 1;
> >  	stp->st_access_bmap = 0;
> >  	stp->st_deny_bmap = 0;
> >  	__set_bit(open->op_share_access & ~NFS4_SHARE_WANT_MASK,
> > @@ -3898,7 +3898,7 @@ alloc_init_lock_stateid(struct nfs4_lockowner *lo, struct nfs4_file *fp, struct
> >  	stp->st_stateid.si_boot = boot_time;
> >  	stp->st_stateid.si_stateownerid = lo->lo_owner.so_id;
> >  	stp->st_stateid.si_fileid = fp->fi_id;
> > -	stp->st_stateid.si_generation = 0;
> > +	stp->st_stateid.si_generation = 1;
> >  	stp->st_access_bmap = 0;
> >  	stp->st_deny_bmap = open_stp->st_deny_bmap;
> >  	stp->st_openstp = open_stp;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] nfsd4: in-stateid seqid should start with 1
  2011-08-31 21:19   ` J. Bruce Fields
@ 2011-08-31 21:29     ` Benny Halevy
  2011-08-31 21:33       ` J. Bruce Fields
  0 siblings, 1 reply; 6+ messages in thread
From: Benny Halevy @ 2011-08-31 21:29 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: linux-nfs, Casey Bodley

On 2011-08-31 14:19, J. Bruce Fields wrote:
> On Wed, Aug 31, 2011 at 01:27:58PM -0700, Benny Halevy wrote:
>> Don't we also need the following?
>>
>> As per RFC5661, skip zero seqid when wrapping around
>> while updating a stateid.
> 
> Yep, done:
> 
> 	http://marc.info/?l=linux-nfs&m=131439774426154&w=2

yup, thanks!

> 
> I need to send out my patches one at a time rather than fifteen at once
> if I want people to read them....

My bad :-)

Benny

> 
> --b.
> 
>>
>> Signed-off-by: Benny Halevy <bhalevy@tonian.com>
>>
>> git diff --stat -p -M
>>  fs/nfsd/state.h |    5 ++++-
>>  1 files changed, 4 insertions(+), 1 deletions(-)
>>
>> diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h
>> index 77f98b8..7d18d3e 100644
>> --- a/fs/nfsd/state.h
>> +++ b/fs/nfsd/state.h
>> @@ -289,7 +289,10 @@ struct nfs4_client_reclaim {
>>  static inline void
>>  update_stateid(stateid_t *stateid)
>>  {
>> -	stateid->si_generation++;
>> +	u32 new = stateid->si_generation + 1;
>> +	if (new == 0)
>> +		new = 1;
>> +	stateid->si_generation = new;
>>  }
>>
>>  /* A reasonable value for REPLAY_ISIZE was estimated as follows:
>>
>> On 2011-08-31 12:53, J. Bruce Fields wrote:
>>> From: J. Bruce Fields <bfields@redhat.com>
>>>
>>> Thanks to Casey for reminding me that 5661 gives a special meaning to a
>>> value of 0 in the stateid's seqid field, so we should instead be
>>> starting out stateid's with si_generation 1.
>>>
>>> Reported-by: Casey Bodley <cbodley@citi.umich.edu>
>>> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
>>> ---
>>>  fs/nfsd/nfs4state.c |    6 +++---
>>>  1 files changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
>>> index 49c3dd1..7caa812 100644
>>> --- a/fs/nfsd/nfs4state.c
>>> +++ b/fs/nfsd/nfs4state.c
>>> @@ -251,7 +251,7 @@ alloc_init_deleg(struct nfs4_client *clp, struct nfs4_stateid *stp, struct svc_f
>>>  	dp->dl_stateid.si_boot = boot_time;
>>>  	dp->dl_stateid.si_stateownerid = current_delegid++;
>>>  	dp->dl_stateid.si_fileid = 0;
>>> -	dp->dl_stateid.si_generation = 0;
>>> +	dp->dl_stateid.si_generation = 1;
>>>  	fh_copy_shallow(&dp->dl_fh, &current_fh->fh_handle);
>>>  	dp->dl_time = 0;
>>>  	atomic_set(&dp->dl_count, 1);
>>> @@ -2303,7 +2303,7 @@ init_stateid(struct nfs4_stateid *stp, struct nfs4_file *fp, struct nfsd4_open *
>>>  	stp->st_stateid.si_boot = boot_time;
>>>  	stp->st_stateid.si_stateownerid = oo->oo_owner.so_id;
>>>  	stp->st_stateid.si_fileid = fp->fi_id;
>>> -	stp->st_stateid.si_generation = 0;
>>> +	stp->st_stateid.si_generation = 1;
>>>  	stp->st_access_bmap = 0;
>>>  	stp->st_deny_bmap = 0;
>>>  	__set_bit(open->op_share_access & ~NFS4_SHARE_WANT_MASK,
>>> @@ -3898,7 +3898,7 @@ alloc_init_lock_stateid(struct nfs4_lockowner *lo, struct nfs4_file *fp, struct
>>>  	stp->st_stateid.si_boot = boot_time;
>>>  	stp->st_stateid.si_stateownerid = lo->lo_owner.so_id;
>>>  	stp->st_stateid.si_fileid = fp->fi_id;
>>> -	stp->st_stateid.si_generation = 0;
>>> +	stp->st_stateid.si_generation = 1;
>>>  	stp->st_access_bmap = 0;
>>>  	stp->st_deny_bmap = open_stp->st_deny_bmap;
>>>  	stp->st_openstp = open_stp;
> --
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] nfsd4: in-stateid seqid should start with 1
  2011-08-31 21:29     ` Benny Halevy
@ 2011-08-31 21:33       ` J. Bruce Fields
  2011-09-08 12:32         ` Benny Halevy
  0 siblings, 1 reply; 6+ messages in thread
From: J. Bruce Fields @ 2011-08-31 21:33 UTC (permalink / raw)
  To: Benny Halevy; +Cc: linux-nfs, Casey Bodley

On Wed, Aug 31, 2011 at 02:29:22PM -0700, Benny Halevy wrote:
> On 2011-08-31 14:19, J. Bruce Fields wrote:
> > On Wed, Aug 31, 2011 at 01:27:58PM -0700, Benny Halevy wrote:
> >> Don't we also need the following?
> >>
> >> As per RFC5661, skip zero seqid when wrapping around
> >> while updating a stateid.
> > 
> > Yep, done:
> > 
> > 	http://marc.info/?l=linux-nfs&m=131439774426154&w=2
> 
> yup, thanks!
> 
> > 
> > I need to send out my patches one at a time rather than fifteen at once
> > if I want people to read them....
> 
> My bad :-)

I'm gonna start inserting little "respond here if you read this far"
comments.

And actually I didn't read Casey's report carefully: he was just
complaining about delegation stateid's.  I don't think they matter much,
as their seqid field never changes, but may as well use the same as the
others.  And while we're there, make this uniform for v4.0 as well.

--b.

commit 80809fa40f8cfb3cf0bf006e3218bbd00584b38d
Author: J. Bruce Fields <bfields@redhat.com>
Date:   Wed Aug 31 15:47:21 2011 -0400

    nfsd4: make delegation stateid's seqid start at 1
    
    Thanks to Casey for reminding me that 5661 gives a special meaning to a
    value of 0 in the stateid's seqid field, so all stateid's should start
    out with si_generation 1.  We were doing that in the open and lock
    cases for minorversion 1, but not for the delegation stateid, and not
    for openstateid's with v4.0.
    
    It doesn't *really* matter much for v4.0 or for delegation stateid's
    (which never get the seqid field incremented), but we may as well do the
    same for all of them.
    
    Reported-by: Casey Bodley <cbodley@citi.umich.edu>
    Signed-off-by: J. Bruce Fields <bfields@redhat.com>

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 49c3dd1..dc83ca1 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -251,7 +251,7 @@ alloc_init_deleg(struct nfs4_client *clp, struct nfs4_stateid *stp, struct svc_f
 	dp->dl_stateid.si_boot = boot_time;
 	dp->dl_stateid.si_stateownerid = current_delegid++;
 	dp->dl_stateid.si_fileid = 0;
-	dp->dl_stateid.si_generation = 0;
+	dp->dl_stateid.si_generation = 1;
 	fh_copy_shallow(&dp->dl_fh, &current_fh->fh_handle);
 	dp->dl_time = 0;
 	atomic_set(&dp->dl_count, 1);
@@ -2303,6 +2303,7 @@ init_stateid(struct nfs4_stateid *stp, struct nfs4_file *fp, struct nfsd4_open *
 	stp->st_stateid.si_boot = boot_time;
 	stp->st_stateid.si_stateownerid = oo->oo_owner.so_id;
 	stp->st_stateid.si_fileid = fp->fi_id;
+	/* note will be incremented before first return to client: */
 	stp->st_stateid.si_generation = 0;
 	stp->st_access_bmap = 0;
 	stp->st_deny_bmap = 0;
@@ -2893,7 +2894,6 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
 		status = nfs4_upgrade_open(rqstp, fp, current_fh, stp, open);
 		if (status)
 			goto out;
-		update_stateid(&stp->st_stateid);
 	} else {
 		status = nfs4_new_open(rqstp, &stp, fp, current_fh, open);
 		if (status)
@@ -2904,9 +2904,8 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
 			release_open_stateid(stp);
 			goto out;
 		}
-		if (nfsd4_has_session(&resp->cstate))
-			update_stateid(&stp->st_stateid);
 	}
+	update_stateid(&stp->st_stateid);
 	memcpy(&open->op_stateid, &stp->st_stateid, sizeof(stateid_t));
 
 	if (nfsd4_has_session(&resp->cstate))
@@ -3898,6 +3897,7 @@ alloc_init_lock_stateid(struct nfs4_lockowner *lo, struct nfs4_file *fp, struct
 	stp->st_stateid.si_boot = boot_time;
 	stp->st_stateid.si_stateownerid = lo->lo_owner.so_id;
 	stp->st_stateid.si_fileid = fp->fi_id;
+	/* note will be incremented before first return to client: */
 	stp->st_stateid.si_generation = 0;
 	stp->st_access_bmap = 0;
 	stp->st_deny_bmap = open_stp->st_deny_bmap;

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] nfsd4: in-stateid seqid should start with 1
  2011-08-31 21:33       ` J. Bruce Fields
@ 2011-09-08 12:32         ` Benny Halevy
  0 siblings, 0 replies; 6+ messages in thread
From: Benny Halevy @ 2011-09-08 12:32 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: linux-nfs, Casey Bodley

On 2011-08-31 17:33, J. Bruce Fields wrote:
> On Wed, Aug 31, 2011 at 02:29:22PM -0700, Benny Halevy wrote:
>> On 2011-08-31 14:19, J. Bruce Fields wrote:
>>> On Wed, Aug 31, 2011 at 01:27:58PM -0700, Benny Halevy wrote:
>>>> Don't we also need the following?
>>>>
>>>> As per RFC5661, skip zero seqid when wrapping around
>>>> while updating a stateid.
>>>
>>> Yep, done:
>>>
>>> 	http://marc.info/?l=linux-nfs&m=131439774426154&w=2
>>
>> yup, thanks!
>>
>>>
>>> I need to send out my patches one at a time rather than fifteen at once
>>> if I want people to read them....
>>
>> My bad :-)
> 
> I'm gonna start inserting little "respond here if you read this far"
> comments.
> 
> And actually I didn't read Casey's report carefully: he was just
> complaining about delegation stateid's.  I don't think they matter much,
> as their seqid field never changes, but may as well use the same as the
> others.  And while we're there, make this uniform for v4.0 as well.

Ack :)

> 
> --b.
> 
> commit 80809fa40f8cfb3cf0bf006e3218bbd00584b38d
> Author: J. Bruce Fields <bfields@redhat.com>
> Date:   Wed Aug 31 15:47:21 2011 -0400
> 
>     nfsd4: make delegation stateid's seqid start at 1
>     
>     Thanks to Casey for reminding me that 5661 gives a special meaning to a
>     value of 0 in the stateid's seqid field, so all stateid's should start
>     out with si_generation 1.  We were doing that in the open and lock
>     cases for minorversion 1, but not for the delegation stateid, and not
>     for openstateid's with v4.0.
>     
>     It doesn't *really* matter much for v4.0 or for delegation stateid's
>     (which never get the seqid field incremented), but we may as well do the
>     same for all of them.
>     
>     Reported-by: Casey Bodley <cbodley@citi.umich.edu>
>     Signed-off-by: J. Bruce Fields <bfields@redhat.com>
> 
> diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
> index 49c3dd1..dc83ca1 100644
> --- a/fs/nfsd/nfs4state.c
> +++ b/fs/nfsd/nfs4state.c
> @@ -251,7 +251,7 @@ alloc_init_deleg(struct nfs4_client *clp, struct nfs4_stateid *stp, struct svc_f
>  	dp->dl_stateid.si_boot = boot_time;
>  	dp->dl_stateid.si_stateownerid = current_delegid++;
>  	dp->dl_stateid.si_fileid = 0;
> -	dp->dl_stateid.si_generation = 0;
> +	dp->dl_stateid.si_generation = 1;
>  	fh_copy_shallow(&dp->dl_fh, &current_fh->fh_handle);
>  	dp->dl_time = 0;
>  	atomic_set(&dp->dl_count, 1);
> @@ -2303,6 +2303,7 @@ init_stateid(struct nfs4_stateid *stp, struct nfs4_file *fp, struct nfsd4_open *
>  	stp->st_stateid.si_boot = boot_time;
>  	stp->st_stateid.si_stateownerid = oo->oo_owner.so_id;
>  	stp->st_stateid.si_fileid = fp->fi_id;
> +	/* note will be incremented before first return to client: */
>  	stp->st_stateid.si_generation = 0;
>  	stp->st_access_bmap = 0;
>  	stp->st_deny_bmap = 0;
> @@ -2893,7 +2894,6 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
>  		status = nfs4_upgrade_open(rqstp, fp, current_fh, stp, open);
>  		if (status)
>  			goto out;
> -		update_stateid(&stp->st_stateid);
>  	} else {
>  		status = nfs4_new_open(rqstp, &stp, fp, current_fh, open);
>  		if (status)
> @@ -2904,9 +2904,8 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
>  			release_open_stateid(stp);
>  			goto out;
>  		}
> -		if (nfsd4_has_session(&resp->cstate))
> -			update_stateid(&stp->st_stateid);
>  	}
> +	update_stateid(&stp->st_stateid);
>  	memcpy(&open->op_stateid, &stp->st_stateid, sizeof(stateid_t));
>  
>  	if (nfsd4_has_session(&resp->cstate))
> @@ -3898,6 +3897,7 @@ alloc_init_lock_stateid(struct nfs4_lockowner *lo, struct nfs4_file *fp, struct
>  	stp->st_stateid.si_boot = boot_time;
>  	stp->st_stateid.si_stateownerid = lo->lo_owner.so_id;
>  	stp->st_stateid.si_fileid = fp->fi_id;
> +	/* note will be incremented before first return to client: */
>  	stp->st_stateid.si_generation = 0;
>  	stp->st_access_bmap = 0;
>  	stp->st_deny_bmap = open_stp->st_deny_bmap;
> --
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2011-09-08 12:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-31 19:53 [PATCH] nfsd4: in-stateid seqid should start with 1 J. Bruce Fields
2011-08-31 20:27 ` Benny Halevy
2011-08-31 21:19   ` J. Bruce Fields
2011-08-31 21:29     ` Benny Halevy
2011-08-31 21:33       ` J. Bruce Fields
2011-09-08 12:32         ` Benny Halevy

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).