git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Chris Mason <chris.mason@oracle.com>,
	btrfs-devel@oss.oracle.com,
	Paul Collins <paul@burly.ondioline.org>,
	git@vger.kernel.org
Subject: Re: [Btrfs-devel] btrfs and git-reflog
Date: Sun, 27 Jan 2008 00:08:59 -0800	[thread overview]
Message-ID: <7vprvny9k4.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <alpine.LFD.1.00.0801262314360.3222@www.l.google.com> (Linus Torvalds's message of "Sat, 26 Jan 2008 23:22:32 -0800 (PST)")

Linus Torvalds <torvalds@linux-foundation.org> writes:

> Yes, but the potential problem is actually very different:
>
>  - directory contains 'a', 'b' and 'c'
>
> 	* opendir()
> 	* readdir() returns 'a'
> 	  * unlink('a');
> 	* readdir() returns 'c', having skipped 'b'.
>
> This is something that could in theory happen if a directory is indexed 
> using the *position* of a filename in a directory. 'a' was position 1, 'b' 
> was position 2, and 'c' was position 3. After the first readdir(), the 
> file position was 2 (pointing at 'b'), but when we removed 'a', the other 
> entries positions moved down, and now 'b' is at position 1, and 'c' is at 
> position '2'. When we call readdir() the next time, it skips 'b' (because 
> it already returned position 1!), and returns 'c'.
>
> See?

Yes, I had that one in mind too, but that will cause us to miss
'b' and its only effect is to leave 'b' unpacked.  If we somehow
dropped 'b' and lost information that is a different story, but
I do not think this failure mode would cause our current code to
do so.  So I do not think is a big deal even if some filesystem
had a bug like that.

  reply	other threads:[~2008-01-27  8:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-25  8:15 btrfs and git-reflog Paul Collins
2008-01-25  9:50 ` Paul Collins
2008-01-25 15:01 ` [Btrfs-devel] " Chris Mason
2008-01-25 15:50 ` Chris Mason
2008-01-25 17:09   ` Linus Torvalds
2008-01-25 20:05     ` Junio C Hamano
2008-01-26  7:52       ` Junio C Hamano
2008-01-27  7:22         ` Linus Torvalds
2008-01-27  8:08           ` Junio C Hamano [this message]
2008-01-26  7:53       ` reflog-expire: Avoid creating new files in a directory inside readdir(3) loop Junio C Hamano

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=7vprvny9k4.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=btrfs-devel@oss.oracle.com \
    --cc=chris.mason@oracle.com \
    --cc=git@vger.kernel.org \
    --cc=paul@burly.ondioline.org \
    --cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).