linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* NFSv3 caching vs NFSv4
@ 2012-09-05 12:40 Diego Moreno
  2012-09-05 14:49 ` Myklebust, Trond
  0 siblings, 1 reply; 4+ messages in thread
From: Diego Moreno @ 2012-09-05 12:40 UTC (permalink / raw)
  To: linux-nfs

Hello everyone,

Performing some attribute caching tests I think I found some 
inconsistencies between nfsv3 and nfsv4. Running a kernel based on 
rhel6.3 (2.6.32-279.el6.x86_64) I found nfsv4 doesn't manage a file 
modified on the server side (even with the noac mount option) while 
nfsv3 does.

My test will be modifying a file every second on the server mount point:

[root@nfs ~]#  FILE=/tmp/nfs_server/myfile ;  while true ; do sleep 1 ; 
sed -i 's/text1/text2/g' $FILE ; cat $FILE ; sleep 1; sed -i 
's/text2/text1/g' $FILE ; cat $FILE ; done
text2
text1
text2
text1
text2
(and so on...)

Meanwhile, the client (which BTW is the same machine) will read the file 
every second :

With NFSv4:

[root@nfs ~]# mount -o noac,vers=4 nfs:/tmp/nfs_server/ /tmp/nfs_client/
[root@nfs ~]# for i in 1 2 3 4 5 ; do cat /tmp/nfs_client/myfile; sleep 
1 ; done
text2
text1
text1
text1
text1

With NFSv3:
[root@nfs ~]# mount -o noac,vers=3 nfs:/tmp/nfs_server/ /tmp/nfs_client/
[root@nfs ~]# for i in 1 2 3 4 5 ; do cat /tmp/nfs_client/myfile; sleep 
1 ; done
text1
text2
text1
text2
text1

I can see in the tcpdump traces how the new change attribute and the 
FATTR4_TIME_MODIFY attributes are well received but it's as if the nfs 
client were ignoring these changes. I've been searching in the NFS list 
but I didn't find anything similar. Is this a bug or just a normal 
behavior? Sorry if it has been already pointed out.

Regards,

Diego Moreno

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

* Re: NFSv3 caching vs NFSv4
  2012-09-05 12:40 NFSv3 caching vs NFSv4 Diego Moreno
@ 2012-09-05 14:49 ` Myklebust, Trond
  2012-09-05 17:21   ` J. Bruce Fields
  0 siblings, 1 reply; 4+ messages in thread
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YnV0IEkgZGlkbid0IGZpbmQgYW55dGhpbmcgc2ltaWxhci4gSXMgdGhp
cyBhIGJ1ZyBvciBqdXN0IGEgbm9ybWFsIA0KPiBiZWhhdmlvcj8gU29ycnkgaWYgaXQgaGFzIGJl
ZW4gYWxyZWFkeSBwb2ludGVkIG91dC4NCg0KXUlmIHlvdSBjYW4gcmVwcm9kdWNlIHRoZSBzYW1l
IGlzc3VlcyBvbiB0aGUgdXBzdHJlYW0ga2VybmVsLCB0aGVuIGl0IGlzDQpvbiB0b3BpYyBmb3Ig
dGhpcyBsaXN0LCBvdGhlcndpc2UgaXQgaXMgYSBxdWVzdGlvbiBmb3IgUmVkIEhhdC4NCg0KQ2hl
ZXJzDQogIFRyb25kDQotLSANClRyb25kIE15a2xlYnVzdA0KTGludXggTkZTIGNsaWVudCBtYWlu
dGFpbmVyDQoNCk5ldEFwcA0KVHJvbmQuTXlrbGVidXN0QG5ldGFwcC5jb20NCnd3dy5uZXRhcHAu
Y29tDQoNCg==

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

* Re: NFSv3 caching vs NFSv4
  2012-09-05 14:49 ` Myklebust, Trond
@ 2012-09-05 17:21   ` J. Bruce Fields
  2012-09-06  8:17     ` Diego Moreno
  0 siblings, 1 reply; 4+ messages in thread
From: J. Bruce Fields @ 2012-09-05 17:21 UTC (permalink / raw)
  To: Myklebust, Trond; +Cc: Diego Moreno, linux-nfs@vger.kernel.org

On Wed, Sep 05, 2012 at 02:49:18PM +0000, Myklebust, Trond wrote:
> On Wed, 2012-09-05 at 14:40 +0200, Diego Moreno wrote:
> > Hello everyone,
> > 
> > Performing some attribute caching tests I think I found some 
> > inconsistencies between nfsv3 and nfsv4. Running a kernel based on 
> > rhel6.3 (2.6.32-279.el6.x86_64) I found nfsv4 doesn't manage a file 
> > modified on the server side (even with the noac mount option) while 
> > nfsv3 does.
> > 
> > My test will be modifying a file every second on the server mount point:
> > 
> > [root@nfs ~]#  FILE=/tmp/nfs_server/myfile ;  while true ; do sleep 1 ; 
> > sed -i 's/text1/text2/g' $FILE ; cat $FILE ; sleep 1; sed -i 
> > 's/text2/text1/g' $FILE ; cat $FILE ; done
> > text2
> > text1
> > text2
> > text1
> > text2
> > (and so on...)
> > 
> > Meanwhile, the client (which BTW is the same machine) will read the file 
> > every second :
> > 
> > With NFSv4:
> > 
> > [root@nfs ~]# mount -o noac,vers=4 nfs:/tmp/nfs_server/ /tmp/nfs_client/
> > [root@nfs ~]# for i in 1 2 3 4 5 ; do cat /tmp/nfs_client/myfile; sleep 
> > 1 ; done
> > text2
> > text1
> > text1
> > text1
> > text1
> > 
> > With NFSv3:
> > [root@nfs ~]# mount -o noac,vers=3 nfs:/tmp/nfs_server/ /tmp/nfs_client/
> > [root@nfs ~]# for i in 1 2 3 4 5 ; do cat /tmp/nfs_client/myfile; sleep 
> > 1 ; done
> > text1
> > text2
> > text1
> > text2
> > text1
> > 
> > I can see in the tcpdump traces how the new change attribute and the 
> > FATTR4_TIME_MODIFY attributes are well received but it's as if the nfs 
> > client were ignoring these changes. I've been searching in the NFS list 
> > but I didn't find anything similar. Is this a bug or just a normal 
> > behavior? Sorry if it has been already pointed out.
> 
> ]If you can reproduce the same issues on the upstream kernel, then it is
> on topic for this list, otherwise it is a question for Red Hat.

I believe sed -i is actually doing a rename not a file modification.  So
the problem is likely another symptom of the bug that delegations aren't
revoked on rename/link/unlink.  Hoping to post the latest draft of
patches to fix that later today.

--b.

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

* Re: NFSv3 caching vs NFSv4
  2012-09-05 17:21   ` J. Bruce Fields
@ 2012-09-06  8:17     ` Diego Moreno
  0 siblings, 0 replies; 4+ messages in thread
From: Diego Moreno @ 2012-09-06  8:17 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: linux-nfs@vger.kernel.org, Myklebust, Trond

Ok, so this is a delegation bug. I think you're rigth Bruce, I cannot 
see the bug if I just modify the file with vi.

I'll try your delegation patch ASAP.

Thanks,

Diego

On Wed 05 Sep 2012 07:21:58 PM CEST, J. Bruce Fields wrote:
> On Wed, Sep 05, 2012 at 02:49:18PM +0000, Myklebust, Trond wrote:
>> On Wed, 2012-09-05 at 14:40 +0200, Diego Moreno wrote:
>>> Hello everyone,
>>>
>>> Performing some attribute caching tests I think I found some
>>> inconsistencies between nfsv3 and nfsv4. Running a kernel based on
>>> rhel6.3 (2.6.32-279.el6.x86_64) I found nfsv4 doesn't manage a file
>>> modified on the server side (even with the noac mount option) while
>>> nfsv3 does.
>>>
>>> My test will be modifying a file every second on the server mount point:
>>>
>>> [root@nfs ~]#  FILE=/tmp/nfs_server/myfile ;  while true ; do sleep 1 ;
>>> sed -i 's/text1/text2/g' $FILE ; cat $FILE ; sleep 1; sed -i
>>> 's/text2/text1/g' $FILE ; cat $FILE ; done
>>> text2
>>> text1
>>> text2
>>> text1
>>> text2
>>> (and so on...)
>>>
>>> Meanwhile, the client (which BTW is the same machine) will read the file
>>> every second :
>>>
>>> With NFSv4:
>>>
>>> [root@nfs ~]# mount -o noac,vers=4 nfs:/tmp/nfs_server/ /tmp/nfs_client/
>>> [root@nfs ~]# for i in 1 2 3 4 5 ; do cat /tmp/nfs_client/myfile; sleep
>>> 1 ; done
>>> text2
>>> text1
>>> text1
>>> text1
>>> text1
>>>
>>> With NFSv3:
>>> [root@nfs ~]# mount -o noac,vers=3 nfs:/tmp/nfs_server/ /tmp/nfs_client/
>>> [root@nfs ~]# for i in 1 2 3 4 5 ; do cat /tmp/nfs_client/myfile; sleep
>>> 1 ; done
>>> text1
>>> text2
>>> text1
>>> text2
>>> text1
>>>
>>> I can see in the tcpdump traces how the new change attribute and the
>>> FATTR4_TIME_MODIFY attributes are well received but it's as if the nfs
>>> client were ignoring these changes. I've been searching in the NFS list
>>> but I didn't find anything similar. Is this a bug or just a normal
>>> behavior? Sorry if it has been already pointed out.
>>
>> ]If you can reproduce the same issues on the upstream kernel, then it is
>> on topic for this list, otherwise it is a question for Red Hat.
>
> I believe sed -i is actually doing a rename not a file modification.  So
> the problem is likely another symptom of the bug that delegations aren't
> revoked on rename/link/unlink.  Hoping to post the latest draft of
> patches to fix that later today.
>
> --b.
> --
> 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] 4+ messages in thread

end of thread, other threads:[~2012-09-06  8:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-05 12:40 NFSv3 caching vs NFSv4 Diego Moreno
2012-09-05 14:49 ` Myklebust, Trond
2012-09-05 17:21   ` J. Bruce Fields
2012-09-06  8:17     ` Diego Moreno

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