public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rob Landley <rob@landley.net>
To: Al Viro <viro@ftp.linux.org.uk>
Cc: jblunck@suse.de, linux-kernel@vger.kernel.org
Subject: Re: [RFC,PATCH] libfs dcache_readdir() and dcache_dir_lseek() bugfix
Date: Fri, 4 Nov 2005 10:55:33 -0600	[thread overview]
Message-ID: <200511041055.33882.rob@landley.net> (raw)
In-Reply-To: <20051104115101.GH7992@ftp.linux.org.uk>

On Friday 04 November 2005 05:51, Al Viro wrote:
> On Fri, Nov 04, 2005 at 12:38:51PM +0100, jblunck@suse.de wrote:
> > This patch effects all users of libfs' dcache directory implementation.
> >
> > Old glibc implementations (e.g. glibc-2.2.5) are lseeking after every
> > call to getdents(), subsequent calls to getdents() are starting to read
> > from a wrong f_pos, when the directory is modified in between. Therefore
> > not all directory entries are returned. IMHO this is a bug and it breaks
> > applications, e.g. "rm -fr" on tmpfs.
> >
> > SuSV3 only says:
> > "If a file is removed from or added to the directory after the most
> > recent call to opendir() or rewinddir(), whether a subsequent call to
> > readdir_r() returns an entry for that file is unspecified."
>
> IOW, the applications in question are broken since they rely on unspecified
> behaviour, not provided by old libc versions.

Are you sure that's the problem?

Directory starts with 26 files named A-F.
Reading through directory starts at A, makes it to J (position 10).
File B gets deleted.
directory reading continues at new position 11, which is now L.

So directory read returns A-J, L-Z, and never returns K even though K didn't 
change.

The "that file" mentioned by SuSv3 above would be _B_ here.  Not K.  K didn't 
change.

That said, I'm pretty sure it's the old libc behavior that's defective.  If a 
new entry B' had been inserted instead, the directory traversal would have 
seen L twice.  Iterating by position is just wrong...

Rob

  parent reply	other threads:[~2005-11-04 16:55 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-04 11:38 [RFC,PATCH] libfs dcache_readdir() and dcache_dir_lseek() bugfix jblunck
2005-11-04 11:51 ` Al Viro
2005-11-04 12:20   ` jblunck
2005-11-04 12:56     ` Miklos Szeredi
2005-11-04 13:18       ` jblunck
2005-11-04 13:31         ` Miklos Szeredi
2005-11-04 15:11           ` jblunck
2005-11-04 15:16             ` Jörn Engel
2005-11-04 15:34               ` jblunck
2005-11-04 15:45                 ` Jörn Engel
2005-11-04 15:38               ` Miklos Szeredi
2005-11-04 15:32             ` Miklos Szeredi
2005-11-04 15:46               ` jblunck
2005-11-04 15:55                 ` Miklos Szeredi
2005-11-04 16:04                   ` jblunck
2005-11-04 16:19                     ` Miklos Szeredi
2005-11-07 10:17                       ` jblunck
2005-11-04 16:27                     ` Al Viro
2005-11-04 16:27             ` Trond Myklebust
2005-11-04 16:39               ` Miklos Szeredi
2005-11-04 16:55   ` Rob Landley [this message]
2005-11-07 10:06     ` jblunck
2005-11-04 12:52 ` Jörn Engel

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=200511041055.33882.rob@landley.net \
    --to=rob@landley.net \
    --cc=jblunck@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@ftp.linux.org.uk \
    /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