Need help with lockf(),open(..., O_SYNC), fsync() on SUN's

Brad Sherman bks at alfa.berkeley.edu
Thu Mar 21 06:58:00 AEST 1991


[If this is the wrong group, I apologize and would appreciate a
pointer to the right one.]

On both a Sun3 (3.5) network and a SparcStation (4.1) network
we are experiencing file synchronization difficulties.  Two
processes on the same cpu work fine but separate clients, or
client and server seem to fail to work to spec.

    * A Process blocks waiting to aquire file1 via an exclusive lock (lockf()).
    * After gaining the lock, a record in file2 is read and written.
    * An fsync() is issued on file2.
    * The lock is then released on file1.


The problem:
   When running this process on two separate cpu's it seems that a read by
   one client occasionally does not reflect the last write by the other
   process, despite the fsync().

The locking/unlocking of file1 (and blocking caused by it) works fine.
Adding an O_SYNC (on sparc's) to the open() calls does not help.
No other processes are touching file1 or file2.
This is with the standard SUN distributed C compilers and libraries.

Are we doing something wrong here?
-------------------------------
	Brad Sherman (bks at alfa.berkeley.edu)



More information about the Comp.unix.wizards mailing list