mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@suse.cz>
To: mtk.manpages@gmail.com, linux-doc@vger.kernel.org,
	kernel list <linux-kernel@vger.kernel.org>
Subject: fsync.2 does not mention error handling
Date: Tue, 2 Dec 2008 13:06:46 +0100	[thread overview]
Message-ID: <20081202120645.GA5327@elf.ucw.cz> (raw)


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.

...
RETURN VALUE         top

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


--------------


I guess it should mention that any errors during fsync are only
mentioned to the first process calling it... which means that if you

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.
									Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

             reply	other threads:[~2008-12-02 12:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-02 12:06 Pavel Machek [this message]
2008-12-04 19:12 ` Michael Kerrisk
2008-12-08 16:14   ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081202120645.GA5327@elf.ucw.cz \
    --to=pavel@suse.cz \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtk.manpages@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®