EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Writing to file delayed with Linux 2.6.10 & NFS

Started by Bill May 19, 2008
After porting our application from Linux 2.4.26 to Linux 2.6.10, I am
seeing it taking 35 seconds to write to a file when using NFS.

Here is the code I am using to write to the file:

fprintf(fileHandle, "%s\n", msg_p);
fflush(fileHandle);

If I put a printf statement right after this code, I see it
immediately on the screen.

When I run out of flash with Linux 2.6.10, there is no delay in
writing to the file.  When using NFS with Linux 2.4.26, there is no
delay either.

Is there anything in 2.6.10 that causes a delay in writing to a file
with NFS?
In comp.arch.embedded Bill <jobhunts02@aol.com> wrote:

> After porting our application from Linux 2.4.26 to Linux 2.6.10, I am > seeing it taking 35 seconds to write to a file when using NFS.
How do you see this ? Does it take 35 seconds to perform the write, or does it take 35 seconds to see the data arrive on the server ? Are you verifying the new data on the NFS server or are you observing through another mounted NFS client on the same export ?
> Here is the code I am using to write to the file: > > fprintf(fileHandle, "%s\n", msg_p); > fflush(fileHandle); > > If I put a printf statement right after this code, I see it > immediately on the screen. > > When I run out of flash with Linux 2.6.10, there is no delay in > writing to the file. When using NFS with Linux 2.4.26, there is no > delay either. > > Is there anything in 2.6.10 that causes a delay in writing to a file > with NFS?
Could it be that your NFS server is exporting in async mode ? -- :wq ^X^Cy^K^X^C^C^C^C
On May 19, 11:18 am, Ico <use...@zeev.nl> wrote:
> In comp.arch.embedded Bill <jobhunt...@aol.com> wrote: > > > After porting our application from Linux 2.4.26 to Linux 2.6.10, I am > > seeing it taking 35 seconds to write to a file when using NFS. > > How do you see this ? Does it take 35 seconds to perform the write, or > does it take 35 seconds to see the data arrive on the server ? Are you > verifying the new data on the NFS server or are you observing through > another mounted NFS client on the same export ? > > > Here is the code I am using to write to the file: > > > fprintf(fileHandle, "%s\n", msg_p); > > fflush(fileHandle); > > > If I put a printf statement right after this code, I see it > > immediately on the screen. > > > When I run out of flash with Linux 2.6.10, there is no delay in > > writing to the file. When using NFS with Linux 2.4.26, there is no > > delay either. > > > Is there anything in 2.6.10 that causes a delay in writing to a file > > with NFS? > > Could it be that your NFS server is exporting in async mode ? > > -- > :wq > ^X^Cy^K^X^C^C^C^C
I do tail -f on the log file and see that it takes about 35 seconds to be written to. I can see using tcpdump that the data does arrive at the server immediately. How do I check if my "NFS server is exporting in async mode?"
Could it be, just 
sync

solves the problem ?

rds
In comp.arch.embedded Bill <jobhunts02@aol.com> wrote:
> On May 19, 11:18 am, Ico <use...@zeev.nl> wrote: >> In comp.arch.embedded Bill <jobhunt...@aol.com> wrote: >> >> > After porting our application from Linux 2.4.26 to Linux 2.6.10, I am >> > seeing it taking 35 seconds to write to a file when using NFS. >> >> How do you see this ? Does it take 35 seconds to perform the write, or >> does it take 35 seconds to see the data arrive on the server ? Are you >> verifying the new data on the NFS server or are you observing through >> another mounted NFS client on the same export ? >> >> > Here is the code I am using to write to the file: >> >> > fprintf(fileHandle, "%s\n", msg_p); >> > fflush(fileHandle); >> >> > If I put a printf statement right after this code, I see it >> > immediately on the screen. >> >> > When I run out of flash with Linux 2.6.10, there is no delay in >> > writing to the file. When using NFS with Linux 2.4.26, there is no >> > delay either. >> >> > Is there anything in 2.6.10 that causes a delay in writing to a file >> > with NFS? >> >> Could it be that your NFS server is exporting in async mode ? > > I do tail -f on the log file and see that it takes about 35 seconds to > be written to.
Yes, but where (on which machine) are you running the 'tail -f'? On the file server, or on the client that is writing to the file ?
> I can see using tcpdump that the data does arrive at the server > immediately.
That's good, but the server can choose not to write the changes to disk right away for performance purposes, i.e. running in asynchrone mode.
> How do I check if my "NFS server is exporting in async mode?"
Check the /etc/exports file and the 'nfs' man page on your machine. -- :wq ^X^Cy^K^X^C^C^C^C

The 2024 Embedded Online Conference