linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* stat family function problem (php file_exists)
@ 2011-02-24 13:56 larith
  2011-02-25  0:37 ` Trond Myklebust
  0 siblings, 1 reply; 2+ messages in thread
From: larith @ 2011-02-24 13:56 UTC (permalink / raw)
  To: linux-nfs

Hi

I have one nfs server mounted on 2 clients. If I check on client2 if a file exists, then after creating this file on client2 is is not immediately visible to file_exist() function on client2. it was only after some time. how to fix this ?

client1:/mnt/storage0/test# cat a.php
<?php

if (file_exists ($argv[1])) {
    echo "1\n";
} else {
    echo "0\n";
}


client2:/mnt/storage0/test# php a.php test1
0
client1:/mnt/storage0/test# touch test1

client2:/mnt/storage0/test# php a.php test1
0
client2:/mnt/storage0/test# php a.php test1
0
..........
client2:/mnt/storage0/test# php a.php test1
1


mtab:

xxx:/mnt/drbd0/ /mnt/storage0 nfs rw,hard,timeo=7,intr,addr=xxx 0 0

export

/mnt/drbd0        10.0.0.0/8(rw,async,no_subtree_check,no_root_squash,fsid=100)

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

* Re: stat family function problem (php file_exists)
  2011-02-24 13:56 stat family function problem (php file_exists) larith
@ 2011-02-25  0:37 ` Trond Myklebust
  0 siblings, 0 replies; 2+ messages in thread
From: Trond Myklebust @ 2011-02-25  0:37 UTC (permalink / raw)
  To: larith; +Cc: linux-nfs

On Thu, 2011-02-24 at 14:56 +0100, larith wrote: 
> Hi
> 
> I have one nfs server mounted on 2 clients. If I check on client2 if a file exists, then after creating this file on client2 is is not immediately visible to file_exist() function on client2. it was only after some time. how to fix this ?

1) Use open() instead of stat()

or

2) Use the -olookupcache=  mount option (see 'man 5 nfs').

Trond

> client1:/mnt/storage0/test# cat a.php
> <?php
> 
> if (file_exists ($argv[1])) {
>     echo "1\n";
> } else {
>     echo "0\n";
> }

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
Trond.Myklebust@netapp.com
www.netapp.com


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

end of thread, other threads:[~2011-02-25  0:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-24 13:56 stat family function problem (php file_exists) larith
2011-02-25  0:37 ` Trond Myklebust

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