From: Theodore Tso <tytso@valinux.com>
To: Andrew McNamara <andrewm@connect.com.au>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
tytso@valinux.com, linux-kernel@vger.kernel.org
Subject: Re: Ext2, fsync() and MTA's?
Date: Sat, 12 May 2001 11:20:25 -0400 [thread overview]
Message-ID: <20010512112025.E22837@think.thunk.org> (raw)
In-Reply-To: <E14ya9b-0004Bc-00@the-village.bc.nu> <20010512145338.0D3D6285BF@wawura.off.connect.com.au>
In-Reply-To: <20010512145338.0D3D6285BF@wawura.off.connect.com.au>; from andrewm@connect.com.au on Sun, May 13, 2001 at 12:53:37AM +1000
On Sun, May 13, 2001 at 12:53:37AM +1000, Andrew McNamara wrote:
> I seem to recall that in 2.2, fsync behaved like fdatasync, and that
> it's only in 2.4 that it also syncs metadata - is this correct?
No, fsync in 2.2 also sync'ed the metadata. The question was always
the containing directory.
>
> Do the BSD's sync the directory data on an fsync of a file? I guess
> this is the bone of contention - if linux is now doing exactly what BSD
> does, it will make it a lot easier to answer accusations of this
> nature.
I haven't looked at the BSD kernel code in a while, but it's actually
quite difficult to sync the directory data based on the file
descriptor, because you in general don't have a handle on the
directory entry used to open the file. It turns out with Linux that
it's easier to do this, because of the dcache abstraction, but with
BSD internals, it'd be rather difficult, since you can't get back from
the inode to the directory which contains the inode.
Sync'ing the directory entry also doesn't make much sense --- which
directory entry? Suppose an application opens a file with O_CREAT,
and while the file descriptor is opened, it then creates 300 hard
links to that same file to different directories scattered all over
the filesystem. It now does a fsync(); is it supposed to find all of
the directories which have hard links to that inode, and sync them
all? That's pretty unreasonable.
You could make the case that a file which is opened with the O_SYNC |
O_CREAT should sync the directory entry on an open, but to say that
fsync() should scan all directories on the filesystem to sync any hard
links that might have been created (possibly by some other process
that doesn't even have the file open) is quite ridiculous. And if
that's the case, why should the directory which was used to open the
file be treated specially?
- Ted
next prev parent reply other threads:[~2001-05-12 15:21 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-05-12 11:50 Ext2, fsync() and MTA's? Andrew McNamara
2001-05-12 14:13 ` Alan Cox
2001-05-12 14:53 ` Andrew McNamara
2001-05-12 15:20 ` Theodore Tso [this message]
2001-05-21 17:47 ` Stephen C. Tweedie
2001-05-21 22:04 ` Theodore Tso
2001-05-22 15:50 ` Oliver Xymoron
2001-05-22 16:48 ` Stephen C. Tweedie
2001-05-22 16:54 ` Oliver Xymoron
2001-05-22 16:57 ` Stephen C. Tweedie
2001-05-24 1:48 ` Marco d'Itri
2001-05-21 17:41 ` Stephen C. Tweedie
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=20010512112025.E22837@think.thunk.org \
--to=tytso@valinux.com \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=andrewm@connect.com.au \
--cc=linux-kernel@vger.kernel.org \
/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