All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Reiser <reiser@namesys.com>
To: Simon Waters <simonw@zynet.net>
Cc: reiserfs-list@namesys.com
Subject: Re: Directory updates in filesystems
Date: Fri, 29 Oct 2004 14:15:32 -0700	[thread overview]
Message-ID: <4182B2F4.2080607@namesys.com> (raw)
In-Reply-To: <1098955408.29128.TMDA@h34.zynet2.co.uk>

Simon Waters wrote:

>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
>
I think no.  It is quite fixable in a variety of ways.  If someone wants 
to fix it or have it fixed, let me know.

> 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..... :)
>
>
>  
>


  parent reply	other threads:[~2004-10-29 21:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2004-11-01 10:32   ` Simon Waters

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=4182B2F4.2080607@namesys.com \
    --to=reiser@namesys.com \
    --cc=reiserfs-list@namesys.com \
    --cc=simonw@zynet.net \
    /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 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.