From: Peter Staubach <staubach@redhat.com>
To: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: David Warren <warren@atmos.washington.edu>, nfs@lists.sourceforge.net
Subject: Re: NFS caching problem
Date: Mon, 26 Sep 2005 16:11:25 -0400 [thread overview]
Message-ID: <433855ED.2000606@redhat.com> (raw)
In-Reply-To: <1127764918.8327.22.camel@lade.trondhjem.org>
Trond Myklebust wrote:
>m=E5 den 26.09.2005 Klokka 12:13 (-0700) skreiv David Warren:
> =20
>
>>I have discovered a wierd problem with NFSv3 on linux.
>>I have 3 machines
>>machine A and B both mount a disk D from machine C
>>The options are tcp,rw,hard and intr.
>>
>>Program test runs on machine A writing to D:
>>(fortran)
>> program test
>> do i=3D1,10
>> call system("/bin/rm t")
>> open (10, file=3D't', status=3D'new')
>> write(10,*)i
>> write(6,*)i
>> close(10)
>> call sleep(1)
>> enddo
>> end
>>
>>program t2 runs on machine B reading from D:
>>(c, but doesn't have to be)
>>#include <stdlib.h>
>>#include <fcntl.h>
>>main(){
>> char in[80];
>> int file;
>> int len;
>>
>> while(1){
>> file=3Dopen("t", O_RDONLY);
>> len=3Dread(file,in,79);
>> in[len]=3D'\0';
>> printf("%s\n",in);
>> close(file);
>> }
>>}
>>
>>while machine A is counting 1 - 10 and placing these numbers into file=20
>>t, machine B is continually reading 1 from file t, then after a while i=
t=20
>>will switch to another number and read it for a while. In my first=20
>>version of this, I was opening and rewriting the same file. In that=20
>>version, machine B always read 1's. Now that I am creating new inodes=20
>>all the time, it changes every few minutes while I repeatedly rerun tes=
t=20
>>on machine A.
>>
>>Now for the other interresting facts:
>>Reading this file from an unrelated sun during this produces the same=20
>>result as machine B.
>>The same thing under NFSv4 does not do this. It works exactly as one=20
>>would expect it to. As soon as the file is writen, the reader sees the=20
>>new data.
>>
>>Any ideas what I could have done wrong in my NFSv3 set up? Is there som=
e=20
>>kernel parameter that need tweaking? is there some mount option I shoul=
d=20
>>have???
>>Thanks.
>> =20
>>
>
>When I see that problem on my test-rig, it appears to be due to the
>reuse of inode numbers by my server. IOW: the file created by the
>fortran program always ends up having the same inode number (check this
>using 'ls -i t').
>
>In that case, the client is indeed expected to have problems recognising
>that the file has changed w.r.t. the cache.
>
Actually, the server is responsible for changing the file handle when the
inode is reused. There is a semantic called a "generation count" which i=
s
used to differentiate between instances of files (re)using the same inode
number. If the server does not do this, then it is broken and relays thi=
s
breakage on to clients as demonstrated here.
ps
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server.
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
next prev parent reply other threads:[~2005-09-26 20:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-26 19:13 NFS caching problem David Warren
2005-09-26 19:36 ` Peter Staubach
2005-09-26 20:01 ` Trond Myklebust
2005-09-26 20:11 ` Peter Staubach [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-11-13 15:47 nfs " Bernd Schubert
2007-04-20 17:35 NFS " David Warren
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=433855ED.2000606@redhat.com \
--to=staubach@redhat.com \
--cc=nfs@lists.sourceforge.net \
--cc=trond.myklebust@fys.uio.no \
--cc=warren@atmos.washington.edu \
/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