lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20081208161408.GA8163@atrey.karlin.mff.cuni.cz>
Date:	Mon, 8 Dec 2008 17:14:09 +0100
From:	Pavel Machek <pavel@...e.cz>
To:	mtk.manpages@...il.com
Cc:	linux-doc@...r.kernel.org,
	kernel list <linux-kernel@...r.kernel.org>
Subject: Re: fsync.2 does not mention error handling

> Pavel,

> Could you provide some pointers to supporting information / mail
> threads, relating to this?

Mail thread on lkml, "writing to disk, not...."

> > write file
> > fsync file
> > fsync .
> >
> > ... and someone else does "fsync ." in the meantime, you may get
> > success when in fact directory entry of file is not written to the
> > disk.

> Also, I'm still not 100% clear what you are saying above.  Do you mean
> that in this scenario, an error may occur but the first caller above
> won't know of it?

Yes.

>  (It would help if you could write a few sentences
> that you think should be in the man page.)

Ok, see below.

> > fsync() transfers ("flushes") all modified in-core data of (i.e.,
> > modified buffer cache pages for) the file referred to by the file
> > descriptor fd to the disk device (or other permanent storage device)
> > where that file resides.  The call blocks until the device reports
> > that the transfer has completed.  It also flushes metadata information
> > associated with the file (see stat(2)).
> >
> > Calling fsync() does not necessarily ensure that the entry in the
> > directory containing the file has also reached disk.  For that an
> > explicit fsync() on a file descriptor for the directory is also
> > needed.

Replace paragraph with:

On newly created files, explicitely calling fsync on a file descriptor
for a directory is also needed, because calling fsync() on file does
not necessarily ensure that the entry in the directory containing the
file has reached disk.

> >
> > ...
> > RETURN VALUE         top
> >
> > On success, these system calls return zero.  On error, -1 is
> > returned, and errno is set appropriately.

I'd add:

After I/O error, fsync() only returns error condition to the first
process that finishes fsync(). Therefore special care must be taken to
coordinate different processes trying to write data to file/directory.

									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ