[comp.unix.questions] O_SYNC and filesystem updating

hope@gatech.UUCP (02/06/87)

I realize that this subject may have already been beaten to death, but:

When a (regular) file is opened with the O_SYNC flag, the write
syscalls "will not return until both the file data and file status
have been physically updated." (System V 'write' man page)

By "file status" are we to assume that the write syscall also waits for
the superblock to be updated due to inode information changing?  Also, does
it wait for the update of the directory where the file resides (e.g. in
the event of file creation)?

I don't really have the time to look through the source code, and would
appreciate any insight or knowledge on the subject.

Thanks.
-- 
Theodore Hope
School of Information & Computer Science, Georgia Tech, Atlanta GA 30332
CSNet:	Hope @ gatech		ARPA:	Hope@ics.GATECH.EDU
uucp:	...!{akgua,decvax,hplabs,ihnp4,linus,seismo,ulysses}!gatech!hope

guy@gorodish.UUCP (02/09/87)

>By "file status" are we to assume that the write syscall also waits for
>the superblock to be updated due to inode information changing?

No, why?  The only thing in the superblock that would change would be
the free lists of various flavors, and whenever you do an "fsck" they
get rebuilt, so there's no point in guaranteeing their correctness
(they're not state information, they're just hints to the file system
code).

>Also, does it wait for the update of the directory where the file resides
>(e.g. in the event of file creation)?

No.  The only thing it does is guarantee 1) that all writes to the
data blocks of the file are done synchronously, 2) all writes of
indirect blocks of the file are done synchronously, and 3) the inode
is updated synchronously after every write.