Corrupt Data when using NFS on Linux
Subsystems (2)
I work for a small software company that recently began using NFS to implement a solution using a lesser-known database (Appgen). The problem is that we're getting lots of corrupt database files in those files modified via NFS. The on-line manual on linux.org makes the following reference which I think may be relevant:
7.10. File Corruption When Using Multiple Clients
If a file has been modified within one second of its previous modification and left the same size, it will continue to generate the same inode number. Because of this, constant reads and writes to a file by multiple clients may cause file corruption. Fixing this bug requires changes deep within the filesystem layer, and therefore it is a 2.5 item.
I was wondering if someone could clarify what is meant by this. What is the relevance of the inode number? And doesn't the inode of the file stay the same even if it is being modified? Any help would be greatly appreciated. Even some direction as to where else I might look would be helpful. Thanks,
Alan Witz
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
" " == Alan Witz <[email protected]> writes:
> *7.10. File Corruption When Using Multiple Clients*
> If a file has been modified within one second of its
> previous modification and left the same size, it will
> continue to generate the same inode number. Because of
> this, constant reads and writes to a file by multiple
> clients may cause file corruption. Fixing this bug
> requires changes deep within the filesystem layer, and
> therefore it is a 2.5 item.
That passage looks pretty confused to me. The inode number is indeed irrelevant here.
The reason for the problem is that NFS uses the file's mtime and size in order to determine whether or not another NFS client has written to the file since it was last opened.
For most NFS servers, the mtime has a resolution of 1 microsecond or better. Under Linux, however, the mtime has a resolution of 1 second. Hence if your *server* is a Linux machine, then a change by another client that occurs within 1 second of your last change might not cause mtime to be updated. Unless this second change also causes the file size to change, it will appear to your client as if nobody else has touched the file, and file corruption may follow due to the fact that the 2 clients' file caches disagree.
Cheers,
Trond
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs