[prev in list] [next in list] [prev in thread] [next in thread] 

List:       freebsd-hackers
Subject:    Re: fsync(2)
From:       Konstantin Belousov <kostikbel () gmail ! com>
Date:       2020-07-12 20:12:50
Message-ID: 20200712201250.GC44314 () kib ! kiev ! ua
[Download RAW message or body]

On Mon, Jul 13, 2020 at 02:55:32AM +0700, Eugene Grosbein wrote:
> 13.07.2020 2:05, Konstantin Belousov wrote:
> 
> > On Mon, Jul 13, 2020 at 01:49:22AM +0700, Eugene Grosbein wrote:
> >> Hi!
> >>
> >> Assume we have parent process that created a file and keeps it open not writing anything there.
> >> The parent spawns a child passing file name and the child opens it,
> >> fills it with data and exits without fsync()'ing the file.
> >>
> >> In case of UFS there is upto 30 seconds time gap when file size is not updated,
> >> so if crash occurs, the file ends up empty.
> >>
> >> The question: will fsync() in parent work for such still open file descriptor?
> > 
> > fsync() syncs the vnode, not the file or file descriptor. So fsync() on
> > any file descriptor referencing the same vnode, is enough to ensure that
> > the data is written to the underlying volume.
> 
> Thanks! This seems to be undocumented.
> 
> https://pubs.opengroup.org/onlinepubs/009695399/functions/fsync.html does not mention
> implementation details (and could not) but our manual page could be improved, could it?

Our manual page for fsync(2) is already good enough IMO. It talks about
modified data of file. 'With the kernel-colored glasses', it means the
vnode there, but describing the fine difference between file and (vnode,
inode) is perhaps too much of useless details for normal application
writer.
_______________________________________________
freebsd-hackers@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic