intermediate summary of ext3-2.4-0.9.4 thread
A message that is not in the archive (sent off-list or not yet received): 0108030507330F.00440@starship
Quoted 7 lines · Alexander Viro
Quoted 2 lines · Daniel Phillips
There is only one chain of directories from the fd's dentry up to the root, that's the one to sync.
You forgot ".. at any given moment". IOW, operation you propose is inherently racy. You want to do that - you do that in userland.
Applications usually protect their playgrounds - separate uid for instance. If only the application has access to that area, and itself does not trigger races, "at any given moment" is not a restriction.
Signature · 1 line
Matthias Andree
Quoted 3 lines · Matthias Andree
Applications usually protect their playgrounds - separate uid for instance. If only the application has access to that area, and itself does not trigger races, "at any given moment" is not a restriction.
Bingo. The whole thing relies on second-guessing the application. BTW, I can think of very legitimate cases when we want to create a bunch of files, fsync them as we go and then fsync the directory where they had been created. Application knows what and when should be synced _and_ it has a way to ask kernel to sync an object.
BTW, symlinks may be a problem - they can't be opened and symlink creation is asynchronous. And there are applications that _do_ care about them - for all they care, lost symlink is as bad as the need to scan lost+found
fdatasync(2) is also there (was: intermediate summary of ext3-2.4-0.9.4 thread)
In reply to Matthias AndreeQuoted 5 lines · Alexander Viro
Bingo. The whole thing relies on second-guessing the application. BTW, I can think of very legitimate cases when we want to create a bunch of files, fsync them as we go and then fsync the directory where they had been created. Application knows what and when should be synced _and_ it has a way to ask kernel to sync an object.
How portable is fsync()ing the directory?
How USEFUL is it to the application if all other boxen fsync() the directory entries along with the file?
You want to sync the files, but the directory only after you created all of the files? Use fdatasync(2) for the files - it doesn't flush meta data, then sync the directory. It's POSIX, it's SUS v2.
Not everyone has it, though, so you may need to fall back to fsync() on those systems.
Signature · 1 line
Matthias Andree
Re: fdatasync(2) is also there (was: intermediate summary of ext3-2.4-0.9.4 thread)
Quoted 1 line · Matthias Andree
How portable is fsync()ing the directory?
It is as portable as assuming that the directory entries are synced during fsync().
Quoted 3 lines
How USEFUL is it to the application if all other boxen
fsync()the directory entries along with the file?
Except, you can NOT guarantee that this is the case. The spec does NOT require it.
Quoted 3 lines
You want to sync the files, but the directory only after you created all of the files? Use fdatasync(2) for the files - it doesn't flush meta data, then sync the directory. It's POSIX, it's SUS v2.
Is fsync(dir) what you mean here?
mrc
Signature · 3 lines
Mike Castle [email protected] www.netcom.com/~dalgoda/ We are all of us living in the shadow of Manhattan. -- Watchmen fatal ("You are in a maze of twisty compiler features, all different"); -- gcc