All of lore.kernel.org
 help / color / mirror / Atom feed
* Directory updates in filesystems
@ 2004-10-28  9:23 Simon Waters
  2004-10-29  5:26 ` David Masover
  2004-10-29 21:15 ` Hans Reiser
  0 siblings, 2 replies; 6+ messages in thread
From: Simon Waters @ 2004-10-28  9:23 UTC (permalink / raw)
  To: reiserfs-list

There is discussion on maildir happening in the dovecot mailing list.

My question is mostly curiosity driven as I thought I understood "enough" 
about filesystems to answer such questions, and not reiserfs specific (but I 
know it is dear to your hearts).

The discussion focuses on the use of renaming files to add attributes to the 
end of the filename.

If you have multiple processes simultaneously accessing a directory with 
rename of contents (additions and removals add more fun), a simple 
opendir/readir loop will on occasion fail to find a file that exists (i.e. 
the stem part of the file name is the same) because the file has been 
renamed, on most filesystems on most *nix like systems tested.

This seems to be a result of readdir without locks not being atomic on most 
filesystems, but reading a set amount of directory entries then rereading 
further at a later stage.

AIUI BSD FFS is suppose to try and ensure that new records are added to the 
end of list the pointer points to, so that at worst a file is seen twice, but 
this doesn't seem to completely address the problem when testing the most 
general case.

Are there any file systems that fully address this issue, or POSIX calls that 
guaranteed to make an atomic readdir, without specific locking, or must a 
lock be obtained on the directory to ensure that the read is consistent. I 
think that locking is needed in the application if complete consistency is 
required because the underlying behaviour of the OSes/filesystems is so 
variable in this regard, but I'd be interested in understanding what 
characteristics a filesystem would have to have to avoid this.

I think a lock and full read will have significant performance implications, 
since the problem only manifests itself on busy directories, but in a 
journalled metadata environment all it wants is a consistent read, if we 
later stat the file and it is missing we can look for renamed versions.

Of course in a real filesystem you'd just store the attributes in something 
designed for storing custom attributes..... :)

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2004-11-01 10:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-28  9:23 Directory updates in filesystems Simon Waters
2004-10-29  5:26 ` David Masover
2004-10-29 16:38   ` Valdis.Kletnieks
2004-10-29 20:04   ` Hans Reiser
2004-10-29 21:15 ` Hans Reiser
2004-11-01 10:32   ` Simon Waters

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.