Writing to file delayed with Linux 2.6.10 & NFS

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?

Reply to
Bill
Loading thread data ...

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 ?

Could it be that your NFS server is exporting in async mode ?

--
:wq
^X^Cy^K^X^C^C^C^C
Reply to
Ico

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?"

Reply to
Bill

Could it be, just sync

solves the problem ?

rds

Reply to
Guenther Sohler

$ cat /etc/exports /bla *(rw,sync,no_root_squash) /blub *(rw,async)

JB

Reply to
Juergen Beisert

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 ?

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.

Check the /etc/exports file and the 'nfs' man page on your machine.

--
:wq
^X^Cy^K^X^C^C^C^C
Reply to
Ico

It's

/tftpboot/fadsroot-prod6 *(rw,no_root_squash,no_all_squash)

I have tried changing this but nothing seems to help. Since we started seeing this delay when switching from Linux 2.4 to 2.6, is it possible that there is something in the kernel configuration that is causing this? Here is my current Network File System configuration:

# # Network File Systems # CONFIG_NFS_FS=y CONFIG_NFS_V3=y # CONFIG_NFS_V4=y # CONFIG_NFS_DIRECTIO is not set # CONFIG_NFSD is not set CONFIG_ROOT_NFS=y CONFIG_LOCKD=y CONFIG_LOCKD_V4=y # CONFIG_EXPORTFS is not set CONFIG_SUNRPC=y # CONFIG_SUNRPC_GSS=y # CONFIG_RPCSEC_GSS_KRB5=y # CONFIG_RPCSEC_GSS_SPKM3 is not set # CONFIG_SMB_FS is not set # CONFIG_CIFS is not set # CONFIG_NCP_FS is not set # CONFIG_CODA_FS is not set # CONFIG_AFS_FS is not set CONFIG_FS_MBCACHE=y

Reply to
Bill

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.