2006-07-14 15:13:49

by Stefan Palme

[permalink] [raw]
Subject: Re: disabling caching


> However, there is another alternative for your application. NFS
> implements "close-to-open" caching. This means an "open()" will force
> the client to revalidate its cache. Since the *directory* is updated
> during a create, you need to open() the directory to force a cache
> refresh. An opendir() on the directory containing the new file should
> enable your application to see the freshly created file immediately.

Because my application is written in Python, I have no access to the
opendir()-syscall directly. But the Python-Function "listdir()" from
the os module uses this syscall (according to the Python source code).

But after using listdir(), the problem still persists:


callToRemoteApplicationToCreateFile('file1')
os.listdir('/my/imported/directory')
f = file('/my/imported/directory/file1')

--> "No such file or directory"


An "ls /my/imported/directory" shows the file. Are you sure, that
opendir() causes the cache refresh? If yes, the problem must be
on the Python-side, so I have to look there...

thanks and regards
-stefan-





-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs


2006-07-14 15:28:01

by Daniel Forrest

[permalink] [raw]
Subject: Re: disabling caching

Stefan,

> Because my application is written in Python, I have no access to the
> opendir()-syscall directly. But the Python-Function "listdir()" from
> the os module uses this syscall (according to the Python source code).
>
> But after using listdir(), the problem still persists:
>
>
> callToRemoteApplicationToCreateFile('file1')
> os.listdir('/my/imported/directory')
> f = file('/my/imported/directory/file1')
>
> --> "No such file or directory"
>
>
> An "ls /my/imported/directory" shows the file. Are you sure, that
> opendir() causes the cache refresh? If yes, the problem must be
> on the Python-side, so I have to look there...

What I have done in similar cases is the following:

1.) Remote site creates file1
2.) Local site creates foo
3.) Local site tries to link foo to file1 (this should fail)
4.) Local site removes foo
5.) Local site opens file1

In bash the last 4 steps are:

$ touch foo
$ ln foo file1
ln: `file1': File exists
$ rm foo
$ cat file1

Perhaps you could try something similar in Python?

--
Dan


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2006-07-14 15:34:38

by Stefan Palme

[permalink] [raw]
Subject: Re: disabling caching


> What I have done in similar cases is the following:
>
> 1.) Remote site creates file1
> 2.) Local site creates foo
> 3.) Local site tries to link foo to file1 (this should fail)
> 4.) Local site removes foo
> 5.) Local site opens file1
>
> In bash the last 4 steps are:
>
> $ touch foo
> $ ln foo file1
> ln: `file1': File exists
> $ rm foo
> $ cat file1
>
> Perhaps you could try something similar in Python?

Thank you for that tip, maybe I will use this as a last resort,
if I don't find the reason for this "misbehaviour", because it
looks a little big "ugly" and creates a lot of overhead...

Regards
-stefan-




-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2006-07-14 16:01:07

by Daniel Forrest

[permalink] [raw]
Subject: Re: disabling caching

Stefan,

> > What I have done in similar cases is the following:
> >
> > 1.) Remote site creates file1
> > 2.) Local site creates foo
> > 3.) Local site tries to link foo to file1 (this should fail)
> > 4.) Local site removes foo
> > 5.) Local site opens file1
> >
> > In bash the last 4 steps are:
> >
> > $ touch foo
> > $ ln foo file1
> > ln: `file1': File exists
> > $ rm foo
> > $ cat file1
> >
> > Perhaps you could try something similar in Python?
>
> Thank you for that tip, maybe I will use this as a last resort,
> if I don't find the reason for this "misbehaviour", because it
> looks a little big "ugly" and creates a lot of overhead...

Actually there isn't much overhead, since anything you do that ensures
coherency is going to require a round trip to the NFS server. If there
is an already existing file that you know of in the directory you can
eliminate "foo" entirely and just use:

$ ln alreadyexists file1
ln: `file1': File exists


And get the same effect.

--
Dan


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs